【发布时间】:2017-02-15 06:46:24
【问题描述】:
我正在尝试将 ionic2 中的 beta11 转换为 rc0。
我的一个页面有自定义标签作为挂钩 changelogs 我试图更新我的自定义标签,并且页面按照第 7 点解释
将每个自定义组件和管道导入并添加到 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 的页面,我需要这个自定义标签,但出现如下错误
例外:./HomePage 类 HomePage 中的错误 - 内联模板:18:27 原因:未找到 ShopingcartPage 的组件工厂
原始异常:找不到 ShopingcartPage 的组件工厂
【问题讨论】:
标签: angular ionic2 angular2-components