简体   繁体   中英

remove item in ng-repeat using particular id

assume I already got my id, is this the correct way of removing an item of a list? I don't think so because it doesn't work. I tried:

$scope.postItem.splice(id, 1);

my partial html and js here http://jsfiddle.net/Jk7RB/

I don't understand the $index method, so I get the post_id instead. It's easier because I can straight away remove the item by the id in backend.

Using jquery

use remove method like this:

$('#your_id').remove();

If you have id of li:

Using Javascript:

document.getElementById("li_id").remove();

Using Jquery:

$('#li_id').remove();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM