Last active
August 29, 2015 14:06
-
-
Save gerisztein/70973235c819b232bf86 to your computer and use it in GitHub Desktop.
White Space Replace Angular 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
/* | |
* Angular Filter to Remove White Spaces in Expression | |
* | |
* usage: {{ text | whitespace:'str' }} | |
* the argument is optional, the default value is null. | |
* white spaces will be replaced by 'str'. | |
* | |
*/ | |
app.filter('whitespace', function () { | |
return function (val, rep){ | |
rep = rep || ''; | |
return (!val ? '' : val.replace(/ /g, rep); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment