Assigning the value of array element to a variable in AngularJS

603 views Asked by At

I am new to AngularJS, I am making a simple flask app. Where I need to edit the text value. I am able to get the editable text box but I am struggling to assign the correct value in to that text box to make it editable.

Here is my Angular Code

var app = angular.module("app", ['xeditable']);
app.controller('myctrl', function($scope, $http) {
    $scope.myname ="Howdy" ;
    $scope.User=[];
    $http.get("/getdata")
    .then(function(response){
        $scope.User=response.data            
     })
     $scope.edit ={
        me : "task goes here"
     };       
});

Here is my HTML code

<tr ng-repeat="user in User">
    <td> {{user.uid }} </td>
    <td > <a href="#" editable-text="edit.me"  e-label="Edit Task"> {{ user.taskname }} </a>
    <input type="image" class="deleteImg" src="static/img/trash_can.png" height="15px" width="18px" name="removeId" value="{{user.uid}}" > 
    <input type="image" src="static/img/editbtn.svg"  height="15px" width="18px" name="editId" value="{{user.uid}}">
                        
    </td>
</tr>

I wish to assign the task name user clicks on to edit.me model field

Click here to view Image

0

There are 0 answers