I am trying to create a custom filter, but when I try to enter it into my controller, I get an "Unknown provider" error. I checked and double checked all the links, but I donβt see what is wrong.
I know that the file references my index.html correctly, it loads and can be found by the inspector. This is the code I have:
In my app.js app:
angular.module('equiclass', ['equiclass.controllers', 'equiclass.services', 'ngRoute']) .config(function ($routeProvider) { $routeProvider .when('/courses', { templateUrl: 'views/courses.html', controller: 'CourseCtrl' // And some other stuff with routes }); angular.module('equiclass.controllers', ['equiclass.services', 'equiclass.filters']); angular.module('equiclass.services', []); angular.module('equiclass.filters', []);
My filter:
angular.module('equiclass.filters') .filter('testFilter', function() { return function(input) { return undefined; }; });
And the controller:
angular.module('equiclass.controllers') .controller('CourseCtrl', function ($scope, testFilter) { });
Of course, this is pretty simplified, but it just doesn't work, and I don't understand why. I made several services, and they all work and play well.
angularjs angularjs-filter
stinaq
source share