I have added this code into my app.module.ts
providers: [ AppConfigService,{ provide: APP_INITIALIZER,useFactory: (config: AppConfigService) => () => config.getAppConfig(),deps: [AppConfigService],multi: true },]
得到这个错误
问题:我使用了ngx-permission pkg进行许可.我设置了route权限方法.但是当我刷新页面时,主页上的时间重定向却停留在当前页面上.所以我试过to load permissions before application start up method解决这个问题,但得到了这个错误.
config.getAppConfig() // call when application start up
有任何想法请帮忙.其他解决方案也欢迎.
解决方法
我已经解决了这个解决方案的问题
在app.module.ts中创建函数
export function loadConfig(appService: AppConfigService): Function { return () => appService.getAppConfig(); } AppConfigService,{ provide: APP_INITIALIZER,useFactory: loadConfig,multi: true },issue into `HttpInterceptor` so i used injector for that constructor(private inj: Injector) { super( inj.get(XHRBackend),inj.get(RequestOptions) ); }
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。