I am currently using angular version RC-1
can you please explain me how to implement a lazy loading in angular with an example with in the guide lines https://angular.io/docs/ts/latest/guide/style-guide.html#!#sts=Lazy%20Loaded%20Folders
it would be very useful to implement in my project
Prefix Lazy Loaded Folders with + need a example for this also
explicit I need to load my angular 2 components only on demand
app.component.ts
import {Component, ElementRef, AfterViewInit, AfterViewChecked, OnInit, OnDestroy, DoCheck, Input, Output, SimpleChange,
EventEmitter, ContentChild, ContentChildren, Renderer, IterableDiffers, Query, QueryList, TemplateRef,
RouteConfig, Router, ROUTER_DIRECTIVES,
Http, HTTP_PROVIDERS, Headers,
APIServiceHelper
, APIServiceConstants
, Header
, Footer
, LeftNavigation
, sample
, AsyncRoute
} from "./index";
declare var $;
declare function initiateSessionTimeOut(minutes);
declare var System: any;
@Component({
selector: 'my-app',
templateUrl: 'app/app.component.html',
directives: [ROUTER_DIRECTIVES, Header, Footer, LeftNavigation],
providers: [HTTP_PROVIDERS, APIServiceHelper, APIServiceConstants],
host: {
'(document:click)': 'onClick($event)',
}
})
@RouteConfig([
{ path: '/sample', name: 'sample', component: sample, useAsDefault: true },
new AsyncRoute({
path: '/sample',
loader: () => System.import('./app/sample/sample.component').then(m => m.sample),
name: 'sample'
}),
new AsyncRoute({
path: '/sample1',
loader: () => System.import('./app/sample1/sample1.component').then(m => m.sample1),
name: 'sample1'
}),
new AsyncRoute({
path: '/sample2',
loader: () => System.import('./app/sample2/sample2.component').then(m => m.sample2),
name: 'sample2'
}),
])
export class AppComponent implements OnInit {
}