AngularJS supports .empty(), .remove() jQuery functionality. Here in below examples we can see how to empty and remove an element.
Angular2 : If you are looking for Angular2 solution, Please click here

Steps to Empty an Element :

  1. Get angular element of html element
  2. Use .empty() method to clear all data in that element
var myEl = angular.element( document.querySelector( '#divID' ) );
myEl.empty();

Steps to Remove  an Element :

  1. Get angular element
  2. Use .remove() method to remove the element from the document
var myEl = angular.element( document.querySelector( '#divID' ) );
myEl.remove();

13 comments:

  1. This is exactly what i was looking for. Thanks

    ReplyDelete
  2. How can we get element using class name?

    ReplyDelete
    Replies
    1. var myEl = angular.element( document.querySelector( '.className' ) );

      Delete
  3. Is chaining possible after empty()?

    ReplyDelete
  4. Excellently written article, if only all writtens offered the same level of content as you, the internet would be a much better place.
    Dissertation Writing Service

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. So in the event that you wish to recoup your lost password and access your vital record once more, at that point keep perusing this article to discover how... remove password

    ReplyDelete

Blogroll

Follow this blog by Email

Popular Posts