Reputation: 401
Can anyone tell me how to remove all child element of parent div.
Suppose there is ul element. ul has 3 childs. so i want to remove this child and redraw new childs. so that's why i need to remove all child of ul.
can anyone help me?
Upvotes: 1
Views: 2681
Reputation: 6488
That doesn't sound like a particularly Angular-y thing to do -- you're thinking too low-level.
If you have a list of stuff you want to display:
$scope.myStuff = [42, 35, 76];
you can do it with something like
<ul>
<li ng-repeat="x in myStuff"> {{ x }} is a cool number </li>
</ul>
Then just update $scope.myStuff
and angular will take care of the redrawing automatically.
http://docs.angularjs.org/api/ng.directive:ngRepeat
See http://jsfiddle.net/H3sC2/1/ for an example.
Upvotes: 4