Angular ionic2 rc0中未发现组件工厂错误
我正在尝试在ionic2中测试11到rc0 我的一个页面上有一个自定义标记作为peg,我正试图更新我的自定义标记,并按照第7点的说明更新页面 将每个自定义组件和管道导入并添加到src/app/app.module.ts中的声明数组中 我已将componentTags.ts文件移动到src,并查看我的Angular ionic2 rc0中未发现组件工厂错误,angular,ionic2,angular2-components,Angular,Ionic2,Angular2 Components,我正在尝试在ionic2中测试11到rc0 我的一个页面上有一个自定义标记作为peg,我正试图更新我的自定义标记,并按照第7点的说明更新页面 将每个自定义组件和管道导入并添加到src/app/app.module.ts中的声明数组中 我已将componentTags.ts文件移动到src,并查看我的@NgModel @NgModule({ declarations: [ MyApp, LoginPage, HomePage, AboutUsPage,
@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
});
}
}
从'@angular/core'导入{Component,Input,Output,EventEmitter};
@组成部分({
选择器:'计数器',
风格:[`
.数量输入{
显示:柔性;对齐项目:居中;
}
.数量输入.输入宽度{
宽度:50px;
边框:1px实心#bdbdbd;
垫面:5px;
}
离子图标{
左边距:0px;
高度:20px;
垫面:3件;
边缘顶部:5px;
颜色:#64c8dc;
}
钮扣{
背景颜色:钢蓝色;
左边距:0px;
}
`],
模板:`
`
})
导出类QuantityComponent{
@Input()计数器值=0;
@Input()cookie=null;
@Output()counterChange=neweventemitter();
提交(evt){
这个。反变化。发射({
value:this.counterValue,
曲奇:这个,曲奇
});
}
}
我有一个名为shopingcart.ts的页面,因为我需要这个自定义标记,但我得到的错误如下
异常:./HomePage类HomePage-内联模板:18:27中出现错误,原因是:找不到ShopingcartPage的组件工厂
原始异常:未找到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 {}