我是一个新手,试图从 ng-book 2(v49) 学习 Angular2。以下是 article.componenets.ts 文件的内容:
import { Component, OnInit } from '@angular/core';
import { Article } from './article.model';
@Component({
selector: 'app-article',
templateUrl: './article.component.html',
styleUrls: ['./article.component.css'],
host: {
class: 'row'
}
})
export class ArticleComponent implements OnInit {
@Input() article: Article;
voteUp(): boolean {
this.article.voteUp();
return false;
}
voteDown(): boolean {
this.article.voteDown();
return false;
}
ngOnInit() {
}
}
这是 angular-cli 上的错误:
ERROR in C:/Users/saad/Desktop/books/Angular JS2/angular2Reddit/src/app/article/article.component.ts (13,4): Cannot find name 'Input'.)
webpack: Failed to compile.