Angular2(2.4.6) with latest cli giving error on ng serve in browser
See original GitHub issuePlease provide us with the following information:
OS?
Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) Window 7
Versions.
Please run
ng --version
. If there’s nothing outputted, please run in a Terminal:node --version
and paste the result here: 2.4.6
Repro steps.
Was this an app that wasn’t created using the CLI? What change did you do on your code? etc. No, it was built with angular-cli beta 18
The log given by the failure.
Normally this include a stack trace and some more information.
Unhandled Promise rejection: appInits[i] is not a function ; Zone: ; Task: Promise.then ; Value: TypeError: appInits[i] is not a function
Mention any other details that might be useful.
NG-CLi - 1.0.0-beta.28.3 Angular2 : 2.4.6 here is my function in app.module.ts
export function authFactory(auth : LoginService){ return auth.loginUser(); }
Providers are reference like this in app.module.ts
{ provide: APP_INITIALIZER, //useFactory: (auth: AuthService) => () => auth.authUser(), useFactory : authFactory, deps: [LoginService], multi: true }
When app runs, browser is giving error
Unhandled Promise rejection: appInits[i] is not a function ; Zone: ; Task: Promise.then ; Value: TypeError: appInits[i] is not a function
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:14 (3 by maintainers)
Still any one looking for answer on this,
Instead of this export function authFactory(auth : LoginService){ return auth.loginUser(); } has to be changed to export function authFactory(auth : LoginService){ return () => auth.loginUser(); }
@GopiAnnan For president, the best solution of 2017. In all environments, for all languages and operating systems.