【发布时间】:2017-08-24 01:40:51
【问题描述】:
import { Component, Input, OnChanges } from '@angular/core';
@Component({
selector: 'image-display',
templateUrl: './image-display.component.html'
})
export class ImageDisplayComponent implements OnChanges {
@Input() image: File;
@Input() imagePath?: string;
private fileReader: FileReader;
constructor() { }
ngOnChanges() {
if (this.image && this.fileReader) {
this.fileReader.readAsDataURL(this.image);
}
}
}
在使用 AOT 编译时出现以下错误:
PRINHYLTPAP0592:matata ajays$ ng build --prod --aot
/myApp/src/$$_gendir/app/image-uploader/image-display/image-display.component.ngfactory.ts (61,9):
Supplied parameters do not match any signature of call target.
【问题讨论】:
-
image-display.component.ngfactory.ts- 这是您显示的文件还是另一个文件?如果是另一个,也请添加那个。此外,您使用此组件的模板。 -
这里有同样的问题。在 angular 2.4.10 和 cli 1.0 上运行 build prod
-
我在使用 ng2.4.10 升级到 ng cli 1.0 后也遇到了这个问题
-
@doyevaristo,我实际上遇到了 ngOnChanges() 方法的问题。看看下面,我已经接受了答案。
标签: angular angular2-aot