RadSideDrawer无法工作Nativescript 2
我是nativescript的新手,因为我正在学习如何实现导航抽屉,但最终还是出现了一些错误 register.htmlRadSideDrawer无法工作Nativescript 2,nativescript,angular2-nativescript,Nativescript,Angular2 Nativescript,我是nativescript的新手,因为我正在学习如何实现导航抽屉,但最终还是出现了一些错误 register.html <ActionBar title="Custom Title"> <ActionItem ios.systemIcon="9" android.systemIcon="ic_menu_share_holo_light" (tap)="openDrawer()"></ActionItem> </ActionBa
<ActionBar title="Custom Title">
<ActionItem ios.systemIcon="9" android.systemIcon="ic_menu_share_holo_light" (tap)="openDrawer()"></ActionItem>
</ActionBar>
<RadSideDrawer #drawer>
<template drawerSide>
<StackLayout class="p bgc-white">
<ListView row="1">
<template let-item="item" let-i="index">
<StackLayout>
<Label text="WWW" class="page-name" ></Label>
</StackLayout>
</template>
</ListView>
</StackLayout>
</template>
<template drawerMain>
<StackLayout class="m">
<user-list></user-list>
</StackLayout>
</template>
</RadSideDrawer>
以下是我得到的日志
PromiseActionJob@[本机代码]
控制台错误file:///app/tns_modules/@angular/core/bundles/core.umd.js:3481:36:错误上下文:
控制台错误file:///app/tns_modules/@angular/core/bundles/core.umd.js:3482:36:[对象]
控制台错误file:///app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:344:22: 错误:0:0中的错误,原因是:undefined不是对象(计算'this.drawerComponent.sideDrawer')是否将NativeScriptUiSideDrawerModule导入app.module 大概是这样的:
import { NativeScriptUISideDrawerModule } from 'nativescript-telerik-ui/sidedrawer/angular';
@NgModule({
bootstrap: [
AppComponent
],
imports: [
CoreModule,
NativeScriptModule,
PagesModule,
NativeScriptUISideDrawerModule // RIGHT HERE
],
})
export class AppModule { }
入门文档中有概述:您是否已将NativeScript UISideDrawerModule导入到您的app.module中 大概是这样的:
import { NativeScriptUISideDrawerModule } from 'nativescript-telerik-ui/sidedrawer/angular';
@NgModule({
bootstrap: [
AppComponent
],
imports: [
CoreModule,
NativeScriptModule,
PagesModule,
NativeScriptUISideDrawerModule // RIGHT HERE
],
})
export class AppModule { }
入门文档中概述了这一点:您可以从
标签中删除该#抽屉。这与您的问题无关,但为了帮助您的IDE,您可以让您的类在ViewInit
之后实现。您可以从
标记中删除该#抽屉
。这并不是说它与您的问题有关,而是为了帮助您的IDE解决问题,您可以让您的类实现AfterViewInit
。谢谢@Shawn该错误已修复,但抽屉仍未打开谢谢@Shawn该错误已修复,但抽屉仍未打开