ionic2 rc0 中找不到组件工厂错误
No component factory found Error in ionic2 rc0
我正在尝试在 ionic2 中将 beta11 转换为 rc0。
我的一个页面有自定义标签作为挂钩changelogs我正在尝试更新我的自定义标签和页面按照第 7 点解释
Import and add each of your custom components and pipes to the declarations array in src/app/app.module.ts.
我已将我的 componentTags.ts 文件移动到 src 并查看我的 @NgModel
@NgModule({
declarations: [
MyApp,
LoginPage,
HomePage,
AboutUsPage,
PrivacyPolicyPage,
TermsOfUsePage,
ProductSubCategoryPage,
CategoryProductDetailsPage,
CategoryProductDetailsInfoPage,
//custom tags
QuantityComponent
],
imports: [
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
LoginPage,
HomePage,
AboutUsPage,
PrivacyPolicyPage,
TermsOfUsePage,
ProductSubCategoryPage,
CategoryProductDetailsPage,
CategoryProductDetailsInfoPage,
QuantityComponent
],
//directives: [QuantityComponent],
providers: [
Products,
Users,
Configurator,
Rest
]
所以这是我的自定义组件文件 quantityTag.ts 文件
import {Component, Input, Output, EventEmitter} from '@angular/core';
@Component({
selector: 'counter',
styles: [`
.quantity-input {
display:flex; align-items:center;
}
.quantity-input .input-width {
width:50px;
border: 1px solid #bdbdbd;
padding-top: 5px;
}
ion-icon{
margin-left:0px;
height:20px;
padding-top: 3px;
margin-top: 5px;
color:#64c8dc;
}
button{
background-color:SteelBlue;
margin-left: 0px;
}
`],
template: `
<span class="quantity-input" style="">
<input type="text" [(ngModel)]="counterValue" class="input-width"/>
<button small (click)="submit($event)"><ion-icon name="refresh"></ion-icon></button>
</span>
`
})
export class QuantityComponent {
@Input() counterValue = 0;
@Input() cookie = null;
@Output() counterChange = new EventEmitter();
submit(evt){
this.counterChange.emit({
value: this.counterValue,
cookie: this.cookie
});
}
}
我有一个名为 shopingcart.ts 的页面,因为我需要这个自定义标签,但出现如下错误
EXCEPTION: Error in ./HomePage class HomePage - inline template:18:27 caused by: No component factory found for ShopingcartPage
ORIGINAL EXCEPTION: No component factory found for ShopingcartPage
尝试在@NgModules 中添加您的页面
app.module.ts:
import { NgModule } from '@angular/core';
import { IonicApp, IonicModule } from 'ionic-angular';
import { MyApp } from './app.component';
import { AboutPage } from '../pages/about/about';
import { ContactPage } from '../pages/contact/contact';
import { HomePage } from '../pages/home/home';
import { TabsPage } from '../pages/tabs/tabs';
import { LoginPage } from '../pages/loginpage/login-page'
@NgModule({
declarations: [
MyApp,
AboutPage,
ContactPage,
HomePage,
TabsPage,
LoginPage
],
imports: [
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
AboutPage,
ContactPage,
HomePage,
TabsPage,
LoginPage
],
providers: []
})
export class AppModule {}
我正在尝试在 ionic2 中将 beta11 转换为 rc0。
我的一个页面有自定义标签作为挂钩changelogs我正在尝试更新我的自定义标签和页面按照第 7 点解释
Import and add each of your custom components and pipes to the declarations array in src/app/app.module.ts.
我已将我的 componentTags.ts 文件移动到 src 并查看我的 @NgModel
@NgModule({
declarations: [
MyApp,
LoginPage,
HomePage,
AboutUsPage,
PrivacyPolicyPage,
TermsOfUsePage,
ProductSubCategoryPage,
CategoryProductDetailsPage,
CategoryProductDetailsInfoPage,
//custom tags
QuantityComponent
],
imports: [
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
LoginPage,
HomePage,
AboutUsPage,
PrivacyPolicyPage,
TermsOfUsePage,
ProductSubCategoryPage,
CategoryProductDetailsPage,
CategoryProductDetailsInfoPage,
QuantityComponent
],
//directives: [QuantityComponent],
providers: [
Products,
Users,
Configurator,
Rest
]
所以这是我的自定义组件文件 quantityTag.ts 文件
import {Component, Input, Output, EventEmitter} from '@angular/core';
@Component({
selector: 'counter',
styles: [`
.quantity-input {
display:flex; align-items:center;
}
.quantity-input .input-width {
width:50px;
border: 1px solid #bdbdbd;
padding-top: 5px;
}
ion-icon{
margin-left:0px;
height:20px;
padding-top: 3px;
margin-top: 5px;
color:#64c8dc;
}
button{
background-color:SteelBlue;
margin-left: 0px;
}
`],
template: `
<span class="quantity-input" style="">
<input type="text" [(ngModel)]="counterValue" class="input-width"/>
<button small (click)="submit($event)"><ion-icon name="refresh"></ion-icon></button>
</span>
`
})
export class QuantityComponent {
@Input() counterValue = 0;
@Input() cookie = null;
@Output() counterChange = new EventEmitter();
submit(evt){
this.counterChange.emit({
value: this.counterValue,
cookie: this.cookie
});
}
}
我有一个名为 shopingcart.ts 的页面,因为我需要这个自定义标签,但出现如下错误
EXCEPTION: Error in ./HomePage class HomePage - inline template:18:27 caused by: No component factory found for ShopingcartPage
ORIGINAL EXCEPTION: No component factory found for ShopingcartPage
尝试在@NgModules 中添加您的页面
app.module.ts:
import { NgModule } from '@angular/core';
import { IonicApp, IonicModule } from 'ionic-angular';
import { MyApp } from './app.component';
import { AboutPage } from '../pages/about/about';
import { ContactPage } from '../pages/contact/contact';
import { HomePage } from '../pages/home/home';
import { TabsPage } from '../pages/tabs/tabs';
import { LoginPage } from '../pages/loginpage/login-page'
@NgModule({
declarations: [
MyApp,
AboutPage,
ContactPage,
HomePage,
TabsPage,
LoginPage
],
imports: [
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
AboutPage,
ContactPage,
HomePage,
TabsPage,
LoginPage
],
providers: []
})
export class AppModule {}