-
-
Save builtbylane/7237798 to your computer and use it in GitHub Desktop.
/** | |
* Description: | |
* removes white space from text. useful for html values that cannot have spaces | |
* Usage: | |
* {{some_text | nospace}} | |
*/ | |
app.filter('nospace', function () { | |
return function (value) { | |
return (!value) ? '' : value.replace(/ /g, ''); | |
}; | |
}); |
I think you would add this to your app's dependencies, and then in the html, you would do {{ yourinfo | nospace }}
can i do something like {{"[email protected]" | remove text after "@" or don't show text after "@"}
app.filter('hidemaildomain', function () {
return function (value) {
return (!value) ? '' : value.replace(/@.*/g, '');
};
});
Thanks
great! 😄
i have a set as { abc,frd,der}
i need to remove comma and add space
how can i do that
Nice way to introduce filters in AngularJS. Thank you.
Thanks. This works perfectly!
if i type one text box value means next text box show remove spaces.
var app=angular.module("myModule", [])
.controller("myController",function($scope)
{$scope.transformString=function (input){
if(!input){
return input;}
var output="";
for(var i = 0; i < input.length;i++)
{
if(i>=0 && input[i]==input[i].toUpperCase())
{
output = output + " ";
}
output = output + input[i];
} $scope.output=output;
}});
this is the JS code for removing spaces in another text box
thanks for this. worked perfectly. 👍