Angular 自定义\u元素\u架构错误有时仅显示
我将Angular 8更新为Angular 9,运行应用程序会显示错误:Angular 自定义\u元素\u架构错误有时仅显示,angular,typescript,angular-directive,custom-element,Angular,Typescript,Angular Directive,Custom Element,我将Angular 8更新为Angular 9,运行应用程序会显示错误: error NG8002: Can't bind to 'text' since it isn't a known property of 'app-custom-message'. 1. If 'app-custom-message' is an Angular component and it has 'text' input, then verify that it is part of this modu
error NG8002: Can't bind to 'text' since it isn't a known property of 'app-custom-message'.
1. If 'app-custom-message' is an Angular component and it has 'text' input, then verify that
it is part of this module.
我以前没有犯过那个错误
代码如下:
Page.component.ts
<app-custom-message [icon]='"icon.png"' [text]="'the message'"><app-custom-message>
<app-custom-footer></app-custom-footer>
我使用延迟加载,自定义消息和自定义页脚组件位于pageModule域外的共享文件夹中,结构如下:
-PageFolder
--PageComponent
--PageModule
-Shared
--CustomMessage
--CustomFooter
应用程序仍在运行,错误困扰着我,我知道解决方案是在PageModule中导入自定义元素模式,但这样可以防止将来误用组件名称时检测到错误。修改
@Input
,如下所示:
@Input() text;
@Input() url = null;
@Input() icon = null;
显示CustomMessage组件.ts文件
@Input() text;
@Input() url = null;
@Input() icon = null;