这是我第一次尝试使用幻灯片构建应用,并在“制表符”之前登录,这是我在尝试构建时从幻灯片组件和开始获取的以下错误消息 与 离子生成--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.
答案 0 :(得分:0)
检查您的依赖项注入,确认已将组件添加到声明:主模块中的数组
例如:
declarations: [ AppComponent, HelloComponent,ImageComponent,PonyComponent,RaceComponent ],
代替ion-button
使用下面的代码
<button ion-button color="primary">Primary</button>
要解决离子滑动问题,请使用任何beow 2解决方案
您需要将CUSTOM_ELEMENTS_SCHEMA
添加到NgModule.
的模式中
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
...
@NgModule({
imports: [],
...
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class YourModule {}
将IonicModule.forRoot()添加到父模块
@NgModule({ 进口:[ ... IonicModule.forRoot(), ] })