How to Remove HTML Tags from String in AngularJS?
Hello Dev,
Here, I will show you angularjs remove html tags from string. I would like to show you remove html tags from string angularjs. you can understand a concept of angularjs strip tags filter. if you want to see an example of angularjs strip html tags then you are in the right place.
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>
I hope it can help you...
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. 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.
We are Recommending you
- AngularJS Check Checkbox is Checked or Not Example
- PHP AngularJS Populate Dynamic Dropdown Example
- PHP AngularJS Add Remove Input Fields Dynamically Example
- How to Copy to Clipboard without Flash in AngularJS?
- AngularJS Nl2br Filter for Textarea Content Example
- How to Call AngularJS Controller Function in JQuery?
- How to Remove # from URL in AngularJS?
- AngularJS Image Upload with Preview Example
- How to Hide Div After Some Time in AngularJS?
- AngularJS - How to Limit String Length using Filter?
- AngularJS - How to Capitalize the First Letter of Word Example
- How to Remove HTML Tags from String in AngularJS?
- Codeigniter Angularjs http post not working
- How to Push Item to 0 Index or First of $scope Object in AngularJS?