【发布时间】:2020-11-16 08:09:38
【问题描述】:
这是我第一次尝试使用幻灯片构建应用程序并在选项卡之前登录,我在尝试构建时从幻灯片组件和开始时收到以下错误消息 和 离子构建--prod。我想我需要添加一些模块,比如 CUSTOM_ELEMENTS_SCHEMA 有人可以告诉我如何以及在哪里
ERROR in src/app/components/slides/slides.component.html:1:1 - error NG8001: 'ion-content' is not a
known element:
1. If 'ion-content' is an Angular component, then verify that it is part of this module.
2. If 'ion-content' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas'
of this component to suppress this message.
1 <ion-content>
src/app/components/slides/slides.component.ts:5:16
5 templateUrl: './slides.component.html',
~~~~~~~~~~~~~~~~~~~~~~~~~
组件 SlidesComponent 的模板发生错误。 src/app/components/slides/slides.component.html:2:3 - 错误 NG8001: 'ion-slides' 未知 元素: 1. 如果 'ion-slides' 是一个 Angular 组件,那么验证它是这个模块的一部分。 2. 如果 'ion-slides' 是一个 Web 组件,则将 'CUSTOM_ELEMENTS_SCHEMA' 添加到 '@NgModule.schemas' 的 此组件以禁止显示此消息。
2 <ion-slides pager="true" [options]="slideOpts">
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/app/components/slides/slides.component.ts:5:16
5 templateUrl: './slides.component.html',
~~~~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component SlidesComponent.
src/app/components/slides/slides.component.html:2:28 - error NG8002: Can't bind to 'options' since it
isn't a known property of 'ion-slides'.
1. If 'ion-slides' is an Angular component and it has 'options' input, then verify that it is part of
this module.
2. If 'ion-slides' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of
this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.
2 <ion-slides pager="true" [options]="slideOpts">
~~~~~~~~~~~~~~~~~~~~~
src/app/components/slides/slides.component.ts:5:16
5 templateUrl: './slides.component.html',
~~~~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component SlidesComponent.
src/app/components/slides/slides.component.html:3:5 - error NG8001: 'ion-slide' is not a known
element:
1. If 'ion-slide' is an Angular component, then verify that it is part of this module.
2. If 'ion-slide' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of
this component to suppress this message.
3 <ion-slide>
~~~~~~~~~~~
src/app/components/slides/slides.component.ts:5:16
5 templateUrl: './slides.component.html',
~~~~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component SlidesComponent.
src/app/components/slides/slides.component.html:8:5 - error NG8001: 'ion-slide' is not a known
element:
1. If 'ion-slide' is an Angular component, then verify that it is part of this module.
2. If 'ion-slide' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of
this component to suppress this message.
8 <ion-slide>
~~~~~~~~~~~
src/app/components/slides/slides.component.ts:5:16
5 templateUrl: './slides.component.html',
~~~~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component SlidesComponent.
src/app/components/slides/slides.component.html:12:5 - error NG8001: [0m'ion-slide' is not a known
element:
1. If 'ion-slide' is an Angular component, then verify that it is part of this module.
2. If 'ion-slide' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of
this component to suppress this message.
12 <ion-slide>
~~~~~~~~~~~
src/app/components/slides/slides.component.ts:5:16
5 templateUrl: './slides.component.html',
~~~~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component SlidesComponent.
src/app/components/start/start.component.html:1:1 - error NG8001: 'ion-button' is not a known
element:
1. If 'ion-button' is an Angular component, then verify that it is part of this module.
2. If 'ion-button' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of
this component to suppress this message.
1 <ion-button expand="full" color='secondary' (click)="navigateToLoginPage()">Start</ion-button>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/app/components/start/start.component.ts:6:16
6 templateUrl: './start.component.html',
~~~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component StartComponent.
[ERROR] An error occurred while running subprocess ng.
ng.cmd run app:build:production exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
【问题讨论】:
-
slides.component.ts:5:16 - 如果有任何错误,请参阅第 5 行
-
检查您的依赖注入,确认您已将组件添加到声明中:主模块侧的数组
标签: angularjs angular ionic-framework ionic4 ionic5