/**
* Drawer Support
*
* The angular demo of the mapbox API is based on the side drawer sample app.
*/ import { Component , OnInit , ViewChild } from "@angular/core" ; import { NavigationEnd , Router } from "@angular/router" ; import { RouterExtensions } from "nativescript-angular/router" ; import { DrawerTransitionBase , RadSideDrawer , SlideInOnTopTransition } from "nativescript-ui-sidedrawer" ; import { filter } from "rxjs/operators" ; import * as app from "tns-core-modules/application" ; import { isAndroid , isIOS } from "tns-core-modules/platform" ; import { EventsService } from './services/events.service' ; import { DebugService } from './services/debug.service' ; @ Component ( { moduleId : module . id , selector : "ns-app" , templateUrl : "app.component.html" } ) export class AppComponent implements OnInit { private _activatedUrl : string ; private _sideDrawerTransition : DrawerTransitionBase ; constructor ( private router , private routerExtensions , private eventsService , private debugService ) { } async ngOnInit ( ) { this . _activatedUrl = "/home" ; this . _sideDrawerTransition = new SlideInOnTopTransition ( ) ; this . router . events . pipe ( filter ( ( event ) => event instanceof NavigationEnd ) ) . subscribe ( ( event ) => this . _activatedUrl = event . urlAfterRedirects ) ; } get sideDrawerTransition ( ) : DrawerTransitionBase { return this . _sideDrawerTransition ; } isComponentSelected ( url ) { return this . _activatedUrl === url ; } see MapComponent link link link todo onNavItemTap ( navItemRoute ) { console . log ( "AppComponent::onNavItemTap(): '" + navItemRoute + "' ---- '" + this . debugService . incrementCounter ( navItemRoute ) ) ; this . routerExtensions . navigate ( [ navItemRoute ] , { transition : { name : "fade" } } ) ; const sideDrawer = < RadSideDrawer > app . getRootView ( ) ; sideDrawer . closeDrawer ( ) ; } }