Last active
December 18, 2015 11:29
-
-
Save robbieferrero/5776511 to your computer and use it in GitHub Desktop.
angular widont filter
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
filter('widont', function() { | |
return function(text) { | |
return text.replace(/([^\s])\s+([^\s]+)\s*$/, "$1 $2") | |
} | |
}); |
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
<!-- for this filter to work it must be applied using ng-bind-html-unsafe --> | |
<div ng-bind-html-unsafe="thing.description | widont"></div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment