Naga Bhavani
Naga Bhavani

Reputation: 105

How to add object into table using angularjs

http://jsfiddle.net/U3pVM/17674/

Once analyse the code in the above fiddle...What I am trying is when even i enter a item in text box ,the value should be added to the table.

I mean the output is:

       Item     |   Done
       Shopping |   checkbox with checked if status is true
       Cleaning |   checkbox based on status

If I add another item in the textbox,that must be added to table dynamically with checkbox false

Upvotes: 0

Views: 85

Answers (2)

Divya MV
Divya MV

Reputation: 2053

In your add function push the new item to the scope variable as its an array like given below

$scope.add=function(myvar)
            {
                $scope.tasks.push({item:myvar,status:false});
            }

Here is the working fiddle

Upvotes: 0

katmanco
katmanco

Reputation: 1212

it is easy just put $scope.tasks.push({item:myvar,status:false}); into add function .

Upvotes: 1

Related Questions