Angular 7 : Injected service is undefined

前端 未结 3 1990
抹茶落季
抹茶落季 2021-02-18 12:50

I tried to inject AccountService in the LoginService but it won\'t ,the accountService is undefined but in the other hand the authServiceProvider is defined .

Contraril

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-18 13:28

    The same thing happened to me, the solution was the one mentioned by the user span

    -> Passing arrow function instead of regular function in the callback. Arrow functions don't have its own this.

    Difference between regular functions and arrow functions here

提交回复
热议问题