ERROR in Error encountered resolving symbol values statically. Function calls are not supported. Con

来源:互联网 发布:java开发工具怎么用 编辑:程序博客网 时间:2024/05/17 06:22

ERROR in Error encountered resolving symbol values statically. Call function 'provideAuth',
Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function

解决办法:

  1. Define your Authorization module like this:

@NgModule({ providers: [ { provide: AuthHttp, useFactory: authHttpServiceFactory, deps: [Http, RequestOptions] } ] }) export class AuthorizationModule { }

  1. Export authHttpServiceFactory function somewhere in the same file

    export function authHttpServiceFactory(http: Http, options: RequestOptions) { return new AuthHttp(new AuthConfig({ tokenName: 'token', tokenGetter: (() => localStorage.getItem('id_token')), globalHeaders: [{'Content-Type':'application/json'}], headerName: 'Authorization', headerPrefix: 'JWT', noJwtError: true }), http, options); }


阅读全文
0 0
原创粉丝点击