try 在constructor
或ngOnInit
中获取组件的@Input
值.但它一直都是undefined
.
我用console.log
更新了hero plunker以显示问题(beta).
export class HeroDetailComponent implements OnInit {
constructor(){
console.log('hero', this.hero)
}
public hero: Hero;
ngOnInit() {
console.log('hero', this.hero)
}
}
我做错了什么?