1

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?

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

1 Comment

@priyashivale You gotta give more info than that. What's not working? You're updating some list in your controller but the html element with ng-repeat isn't updating on its own? Post your code (preferably a SSCCE)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.