簡體   English   中英

錯誤:[ng:areq]參數'fn'不是一個函數,未定義(Angular服務的問題)

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

我對Angular 1.x服務有疑問。 這是代碼:

export const MyService = () => {

   //some code
};

當我嘗試將該服務注入此控制器時...

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

    //some code
}

...它引發以下錯誤:

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

我該如何解決?

修復!! 這只是一個迷惑的問題

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM