Skip to content

Instantly share code, notes, and snippets.

@aivascu
Last active August 29, 2015 14:23
Show Gist options
  • Save aivascu/ee23122732557c41cd15 to your computer and use it in GitHub Desktop.
Save aivascu/ee23122732557c41cd15 to your computer and use it in GitHub Desktop.
AngularJS filter for removing HTML
// 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