I am creating an angular2 meteorology application in which I need to do lazy loading.
I tried angular 2 doc for lazy loading.
app.routes.ts
import { Route } from '@angular/router';
import { Meteor } from 'meteor/meteor';
import { LoginComponent } from './modules/loginComponent/login.component';
export const routes: Route[] = [{
path: '',
redirectTo: "login",
pathMatch: "full"
}, {
path: 'login',
component: LoginComponent
}, {
path: 'csvtemplate',
loadChildren: './modules/core/core.module#CoreModule'
}
];
core.route.ts
const routes: Routes = [
{ path: '', component: TemplateComponent,
children: [{
path: '',
redirectTo: 'csvtimeline'
},
{
path: 'csvtimeline',
component: CsvTimelineComponent
}, {
path: 'csvjson',
component: CsvJsonComponent
}, {
path: 'addcategory',
component: CsvAddProductComponent
}, {
path: 'adduser',
component: adduserComponent
}
]
}
];
when I run my code after adding a lazy load, I get this error.
core.umd.js:3257 EXCEPTION: Uncaught (in promise): ReferenceError: System is not defined
ReferenceError: System is not defined
at SystemJsNgModuleLoader.loadAndCompile (http:
at SystemJsNgModuleLoader.load (http:
at RouterConfigLoader.loadModuleFactory (http:
at RouterConfigLoader.load (http:
at MergeMapSubscriber.project (http:
at MergeMapSubscriber._tryNext (http:
at MergeMapSubscriber._next (http:
at MergeMapSubscriber.Subscriber.next (http:
at ScalarObservable._subscribe (http:
at ScalarObservable.Observable.subscribe (http:
Why its not working. What should I do to make it work?
can someone tell me how to use lazy loading in angular2 -meteor app?
source
share