AngularJS - how to remove html tags using filter?

By Hardik Savani | April 12, 2016 | | 32729 Viewer | Category : jQuery AngularJS

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>

Do you want to expert php developer or developer team for your projects ?
Contact US