Tutorialsplane

Angularjs remove html element from dom


Angularjs remove html element from dom : There are many ways to remove the element from html dom(document object model). Here in this tutorial we are going to use the .remove() method to remove the element from the document object model.


Angularjs remove html element from dom

You can remove element from dom simply as below –

JavaScript Part

JavaScript Part Contains the following script –

Angularjs remove html element from dom:

 

Html Part

Html Part Contains the following html-

Angularjs remove html element from dom:

<div ng-app="myApp">  
<div ng-controller="myController">  
 
<div id="myDiv" class="amp-wp-inline-f5a2fab0255e0e9220163ba8089500d3"></div>
</div> 

</div>

Complete Part

Let us combine the both JavaScript and Html Part –

Angularjs remove html element from dom:




 
 

  
<div ng-app="myApp">  
<div ng-controller="myController">  
 
<div id="myDiv" class="amp-wp-inline-f5a2fab0255e0e9220163ba8089500d3"></div>
</div> 

  
      


</div>

Try it »

If you run the above example it will remove the div and produce output something like this –