I am creating a custom filter in angular js this is my html,
<div class="box-body">
<div class="form-group">
<label>Page-Title:</label>
<input type="text" required value="" data-ng-model="title" name="page_title" class="form-control" id="" placeholder="Enter Page Title">
</div>
<div class="form-group">
<label>Page-Alias:</label>
<input type="text" value="@{{ title | replaceSpace}}" name="page_alias" class="form-control" id="" placeholder="Auto-Generated If Left Blank">
</div>
This is my angular js code
var app = angular.module('CustomAngular', []);
app.controller('CustomCtrl', function ($scope) {
app.filter('replaceSpace', function () {
return function (input) {
return input.replace(/ /g, '-').toLowerCase();
};
});
});
The filter is not working and also I get error in the console.
Error: [$injector:unpr] http://errors.angularjs.org/1.3.15/$injector/unpr?p0=slugifyFilterProvider%20%3C-%20slugifyFilter
at Error (<anonymous>)
If I use filter: infront of the filter name I donot get any errors in console but it's still not working.
<input type="text" value="@{{ title | filter:replaceSpace }}" name="page_alias" class="form-control" id="" placeholder="Auto-Generated If Left Blank">