【发布时间】:2017-06-18 11:38:04
【问题描述】:
我基本上开始使用 angular 4 并使用 ngChanges 我得到了这个错误
类“GalleryComponent”错误地实现了接口 'OnChanges'.Property 'ngOnChanges' 类型缺失 '画廊组件'。
我真的不知道该怎么办,我知道一个类可以有多个接口,但事件只使用一个它会显示相同的错误
import { Component, OnInit, OnChanges, Input } from '@angular/core';
import { ImageService } from '../image/shared/image.service';
@Component({
selector: 'app-gallery',
templateUrl: './gallery.component.html',
styleUrls: ['./gallery.component.css']
})
export class GalleryComponent implements OnInit, OnChanges {
visibleImages: any[] = [];
constructor(private imageService: ImageService) {
this.visibleImages = this.imageService.getImages();
}
ngOnInit() {}
OnChanges(){}
}
如果有人能注意到我遗漏的东西,我将不胜感激 提前致谢
【问题讨论】:
-
函数定义不是:
ngOnChanges(changes: SimpleChanges)而不是onChanges()? -
woooo 你是对的......那是错误,非常感谢你
标签: angular oop implements