import { Injectable } from "@angular/core" ; import { RouterExtensions } from "@nativescript/angular" ; @ Injectable ( { providedIn : "root" , } ) export class NavigationService { constructor ( private routerExtensions ) { } navigate ( path , params = null , clearHistory = false ) { const routeArray = [ path ] ; if ( params ) { if ( Array . isArray ( params ) ) { routeArray . push ( ... params ) ; } else { routeArray . push ( params ) ; } } this . routerExtensions . navigate ( routeArray , { clearHistory : clearHistory } ) ; } back ( ) { this . routerExtensions . back ( ) ; } }