简体   繁体   中英

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?

Fixed it!! It was just a matter of mistyping

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM