forRoot bug ERROR in Error during template compile of 'AppModule' Function calls are not supported in decorators but 'AuthModule' was called.
See original GitHub issueversion:
"@angular/cli": "1.6.5",
"@angular/*i": "^5.2.0"
ng build --prod model
error: ERROR in Error during template compile of ‘AppModule’ Function calls are not supported in decorators but ‘AuthModule’ was called.
AuthModule.forRoot({
login_url: `/passport/login`,
ignores:[
"passport/login",
"assets/.*",
"test.*"
]
})
AuthModule:
@NgModule({
declarations: [
],
imports: [
],
providers: [
],
exports: [
]
})
export class AuthModule {
public static forRoot(options?:any): ModuleWithProviders {
if (options && options.ignores && options.ignores.length) {
/**字符串数组,如果直接写正则会导致angular项目失败,应该是bug */
options.ignores.map(str => new RegExp(str));
}
return {
ngModule: AuthModule,
providers: [
{ provide: DA_USER_OPTIONS_TOKEN, useValue: options },
{ provide: DA_OPTIONS_TOKEN, useFactory: optionsFactory, deps: [DA_USER_OPTIONS_TOKEN] },
{ provide: DA_STORE_TOKEN, useClass: LocalStorageStore },
{ provide: DA_SERVICE_TOKEN, useClass: TokenService }
]
};
}
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:13
Top Results From Across the Web
ERROR in Error during template compile of 'AppModule ...
I am getting: ERROR in Error during template compile of 'AppModule' Function calls are not supported in decorators but 'XXXModule' was called. I ......
Read more >Solving AOT Error in NgRx: Function calls are not supported in ...
ERROR in src/app/app.module.ts(33,25): Error during template compile of 'AppModule' Function calls are not supported in decorators but 'createAction' was ...
Read more >Angular Modules and NgModule - Complete Guide
An Angular Module is mainly a template compilation context but it also ... lazy loading in AngularJs was not supported directly at the...
Read more >Building Angular 6 library fails, with a vague error.
BUILD ERROR. Error during template compile of 'Injectable'. Function calls are not supported in decorators but 'ɵmakeDecorator' was called.
Read more >Calling Function 'Makedecorator' Function Calls Are Not ... - ADocLib
ERROR in Error during template compile of 'AppComponent' Function calls are not supported in decorators but 'beforeMethod' was called in 'log' 'log' calls....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Unexplained specific reasons You can’t write anything else before return before
after
@dongjiyan Could you re-open the issue please?