AngularJS - how to remove html tags using filter?
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>

Hardik Savani
I'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.