Angular2/4にて、Cannot find name SimpleChangesエラーが出た時の対処法
Angular2/4にて、Cannot find name SimpleChangesエラー
変更検知をしたかったので、以下の記述をしたところ、
Cannot find name 'SimpleChanges'.
というコンパイルエラーが出た。
export class ChildComponent implements OnInit, OnChanges { @Input() parentProperty; private formattedData; constructor() { } ngOnInit() { } ngOnChanges(changes :SimpleChanges) { console.log('changes'); } }
解決方法
import { SimpleChanges } from '@angular/core';
を追加してやればOK.
参考
stackoverflowさん、いつもありがとうございます。