我正在尝试将 MSAL 添加到现有的旧 angular v6 项目中,所以我运行了:
npm install @azure/msal-angular@1.1.2 --save
npm install 'msal@1.4.4' --save
我像往常一样将代码添加到 app.component.ts 和 app.module.ts 中,http 拦截器和每个配置的工厂都没有什么特别之处。它编译得很好,但是当我运行它时,我在控制台中得到了这个:
Error: StaticInjectorError(AppModule)[InjectionToken HTTP_INTERCEPTORS -> BroadcastService]:
StaticInjectorError(Platform: core)[InjectionToken HTTP_INTERCEPTORS -> BroadcastService]:
NullInjectorError: No provider for BroadcastService!
at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:1062)
at resolveToken (core.js:1300)
at tryResolveToken (core.js:1244)
at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1141)
at resolveToken (core.js:1300)
at tryResolveToken (core.js:1244)
at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1141)
at resolveNgModuleDep (core.js:8369)
at _createClass (core.js:8422)
at _createProviderInstance (core.js:8386)
知道我可能忘记了什么吗?据我所知, BroadcastService 应该来自 msal 本身,不知道为什么它会丢失。