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();

5 comments:

Blogroll

Follow this blog by Email

Popular Posts