AngularJS - how to remove html tags using filter?

By Hardik Savani September 5, 2020 Category : jQuery Angular

Whenever you require to strip HTML tags usign Angular Filter, then this post can help you. If you are working on php then it is very easily use predefine function But in AngularJS you need to make your own filter for remove html tag from string. So, In bellow example you can see how to create and use it.

Create Filter:

var app = angular.module('myHDApp', []);

app.filter('removeHTMLTags', function() {

return function(text) {

return text ? String(text).replace(/<[^>]+>/gm, '') : '';



Use Filter:

<p>{{ yourText | removeHTMLTags }}</p>

We are Recommending you