How to delete item from array angularjs? -


why can't remove item array posts?

html tag delete item

html tag <span ng-click="remove($index)"> delete</span>  //angularjs method try delete item blog.remove = function(index) { blog.posts.splice(index, 1); };  //angular array posts blog.posts = [{     "title": "blog post one",     "comments": [       {         "body":"lorem ipsum dolor sit amet, consectetur adipisicing elit. ",         "author": "trollguy87"       }     ]}]; 

where can problem?

try passing item function , getting index item.

as mentioned in below thread.

how delete item or object array using ng-click?


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -