大佬教程收集整理的这篇文章主要介绍了angular – 非法状态:无法加载指令NgClass的摘要,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
{ "compilerOptions": { "baseUrl": ".","declaration": true,"StripInternal": true,"experimentalDecorators": true,"emitDecoratorMetadata": true,"module": "es2015","moduleResolution": "node","outDir": "[...]/","paths": {...},"rootDir": "[...]/plugins/","target": "es5","skipLibcheck": true,"lib": [ "es2015","dom" ],"sourceMap": true,"inlinesources": true,"noImplicitAny": true },"files": [ "[...]/plugins/users/index.ts" ] }
我不知道从我试图编译的文件中导致问题的原因是什么.我在这里和那里看到过类似的错误,但是直接与公共模块无关.发布样本以重现错误很困难,因为它不会发生在其他模块上
编辑1:
我的设置如下:一个模块MymoduleA成功构建,MymoduleB使用不构建的MymoduleA.
@NgModule({ imports: [ CommonModule,IonicModule,TranslateModule.forChild() ] }) export class MymoduleA { static forRoot(): ModuleWithProviders { return { ngModule: MymoduleA,providers: [ ModuleAservice ] }; } } @NgModule({ imports: [ httpClientModule,MymoduleA ] }) export class MymoduleB { /** * Instantiate module (for main module only). */ static forRoot(): ModuleWithProviders { return { ngModule: MymoduleB,providers: [ ModuleBservice ] } } }
如果我在MymoduleB中包含CommonModule,我还有另一个错误:
Error: Illegal state: Could not load the sumMary for directive ActionSheetCmp in [...]/node_modules/ionic-angular/components/action-sheet/action-sheet-component.d.ts
现在我可以在MymoduleB中包含IonicModule以获得下一个非法状态错误(这次链接到translate模块),但我在MymoduleB中根本没有使用这些模块,那么为什么我需要将它们全部导入呢?
@NgModule({ imports: [ CommonModule,TranslateModule.forChild() ],exports: [ CommonModule,TranslateModule ] }) export class MymoduleA { static forRoot(): ModuleWithProviders { return { ngModule: MymoduleA,providers: [ ModuleBservice ] } } }
如果有人知道为什么,请随时赐教:)
以上是大佬教程为你收集整理的angular – 非法状态:无法加载指令NgClass的摘要全部内容,希望文章能够帮你解决angular – 非法状态:无法加载指令NgClass的摘要所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。