I try to create custom filter on the 2nd input, first input takes string, second lowercase it and gets rid of spaces
<input placeholder="Name" ng-model="GrCtrl.name" type="text"/>
<input placeholder="CodeName" ng-model="GrCtrl.name | formatToCode" type="text"/>
and here is the filter:
.controller("controller", function(){
var self = this;
self.cloneUserGroup_name = 'Here We Go';
})
.filter("formatToCode", function(){
return function(input){
return input.toLowerCase().replace(/\s+/g, '');
}
});
thou when I run it, it throws the error
Error: [ngModel:nonassign] Expression 'GrCtrl.code_name | formatToCode' is non-assignable.