我使用nativescript-ui-samples-angular代碼爲RadSideDrawer(側面菜單)的代碼。它完美的工作,但是當我試圖將它們全部包裝在一個單獨的組件中,然後通過選擇器將其添加到其他組件中時,它會變得平坦。通用的側面菜單組件
@ViewChild(RadSideDrawerComponent) public drawerComponent: RadSideDrawerComponent;
private drawer: SideDrawerType;
ngAfterViewInit() {
this.drawer = this.drawerComponent.sideDrawer;
this._changeDetectionRef.detectChanges();
}
它說
無法讀取屬性未定義
'sideDrawer' 我缺少的東西?問題不在於側邊菜單本身,而是將其包裝到可重用組件中。
不能肯定,但我認爲彌敦道沃克使用在ShoutOutPlay(HTTPS一側抽屜:// github.com/NathanWalker/ShoutOutPlay/tree/development/app)可能會嘗試挖掘周圍,看看他是否在應用程序的不同部分重複使用它。 –