O'Reilly logo

NativeScript for Angular Mobile Development by Nathanael J. Anderson, Nathan Walker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Providing NSModuleFactoryLoader for NgModuleFactoryLoader

By default, Angular's built-in module loader uses SystemJS; however, NativeScript provides an enhanced module loader called NSModuleFactoryLoader. Let's provide this in our main routing module to ensure all our modules are loaded with it instead of Angular's default module loader.

Make the following modifications to app/app.routing.ts:

import { NgModule, NgModuleFactoryLoader } from '@angular/core';import { NativeScriptRouterModule, NSModuleFactoryLoader } from 'nativescript-angular/router';const routes: Routes = [  {    path: '',    redirectTo: '/mixer/home',    pathMatch: 'full'  },  {    path: 'mixer',    loadChildren: './modules/mixer/mixer.module#MixerModule'  },  {    path: 'record', loadChildren: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required