我已将我的离子应用程序从beta 11更新为rc0。所以这意味着我已经从angular2 rc4切换到了angular2 stable。Angular 2:调用子组件
我试图用我是从家庭page.html中
<slider-component [title]="sliderTitle[0]" [songs]="recentlyViewedSongs" [viewId]="RecentViewId" ></slider-component>
调用滑盖component.ts的自定义组件,我有这仍然总是的console.log未定义
export class SliderComponent {
@Input() title: string = "";
@Input() songs: any;
@Input() viewId: any = []; //stores id of songs to be shown
constructor(
public nav: NavController,
) {
console.log("In the SliderComponent, this.songs", this.songs); //shows an empty array
}
在我app.module.ts,我使用@NgModule这样
@NgModule({
declarations: [
MyApp,
HomePage,
SliderComponent
],
imports: [
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage,
SliderComponent
],
providers: []
})
export class AppModule {}
关于我在做什么的错误?
感谢您的答复。我可以用ngOnInit获得变量 – Dee