3

I'm trying to make my own filter due to some tutorials in AngularJS.

My code looks like this

angular.module('fooAppFilters', []).filter('scenarioDate', function() {
  return function(input) {
    // do some changes on input
    return input;
  };
});

angular.module('fooApp', ['fooAppFilters']);

function FooCtrl($scope, $http, $ogrAppFilters) {
  // ...
}

Anyway, I'm getting this error:

Error: Unknown provider: $fooAppFiltersProvider <- $fooAppFilters

Can you give me a hint please? I am stuck here for a longer time.

Thank you

1 Answer 1

3

You can only inject service into controller, not module.

To create filters, registering filters with module, then use ng-app="fooApp" in HTML to bootstrap.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! I am very new to angular, this helped me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.