Search code examples
javascriptangularjsangular-services

Error: [ng:areq] Argument 'fn' is not a function, got undefined (problems with Angular service)


I have a problem with an Angular 1.x Service. This is the code:

export const MyService = () => {

   //some code
};

And when I try to inject that Service into this Controller...

export default function MyController(MyService) {
    'ngInject';

    //some code
}

...it throws the following error:

Error: [ng:areq] Argument 'fn' is not a function, got undefined

How can I fix it?


Solution

  • Fixed it!! It was just a matter of mistyping