Last active
August 29, 2015 14:23
-
-
Save aivascu/ee23122732557c41cd15 to your computer and use it in GitHub Desktop.
AngularJS filter for removing HTML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// usage: var app = angular.module('app', ['app.filters']); | |
// {{ expression | plaintext }} | |
'use strict'; | |
(function(angular) { | |
var plaintext = function() { | |
return function(text) { | |
return String(text).replace(/<[^>]+>/gm, ''); | |
}; | |
}; | |
angular.module('app.filters', []).filter('plaintext', plaintext); | |
}(angular)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment