angular - “EventEmitter”类型上不存在属性“自定义”'
问题描述
我正在使用 ionic 3,并且我有一个部件组件和一个部件页面
Parts.html 页面:
<ion-row>
<part [part]="part"></part>
</ion-row>
parts.html的part变量是这个 json:
Part.ts 组件:
import { Component, ViewChild, Input, EventEmitter } from "@angular/core";
export class PartComponent {
@Input() part = new EventEmitter<any>();
ngAfterViewInit(){
this.setInitialValues();
}
ngOnChanges(){
this.setInitialValues();
}
setInitialValues() {
console.log(this.part);
if (this.part) {
if (this.part.hasOwnProperty('parts') && this.part.parts.length != 0) {
this.hasParts = true;
}
this.getPartQuestionnaire(this.part.id);
}
}
我在构建离子应用程序时遇到了这个错误:
“EventEmitter”类型上不存在属性“parts”。
L81: if (this.part.hasOwnProperty('parts') && this.part.parts.length != 0) {
L82:this.hasParts = true;
“EventEmitter”类型上不存在属性“id ”。
L84: this.getPartQuestionnaire(this.part.id);
当我评论 part.ts 的这行并在控制台中显示变量部分时,我得到了 foow 图像表示,其中前 2 个调用显示为空,但在它加载部分值之后:
尝试构建应用程序时如何解决此错误?
我正在建造ionic cordova run browser
解决方案
换行试试
从
@Input() part = new EventEmitter<any>();
到
@Input() part : any;
推荐阅读
- python - 还有另一种按“列”值对 3D numpy 数组进行排序的方法吗?
- c# - 从列表中访问信息
- rest - 为 HTTP 方法提供基本路径
- c# - 如何从字符串中删除所有非希伯来字符并将单词放入数组中?
- python - PyQt5 DatePicker 弹出窗口
- scheme - 如何使用 eval 评估方案/球拍中包含布尔逻辑表达式的列表?
- excel - 查找空白单元格、vlookup、复制、粘贴
- javascript - 在本机反应中映射状态数组
- amazon-web-services - 在 AWS 控制台中的哪里可以找到访问密钥?
- c# - 与特定类型相关联并使其通用的简单 JsonFileDb