From 5ee7fa2064413d332d5c0fe208b67d9c6116f569 Mon Sep 17 00:00:00 2001 From: Meligy Date: Mon, 17 Oct 2016 12:38:25 +1100 Subject: [PATCH] chore: try with version 2.1 --- package.json | 22 +++++++++-------- src/app/app-routing.module.ts | 29 +++++++++++++++++++---- src/app/bundled/bundled-routing.module.ts | 1 - src/app/bundled/index.ts | 3 +++ src/app/index.ts | 2 ++ src/app/lazy/index.ts | 3 +++ src/main.ts | 2 +- 7 files changed, 46 insertions(+), 16 deletions(-) create mode 100644 src/app/bundled/index.ts create mode 100644 src/app/lazy/index.ts diff --git a/package.json b/package.json index c227d5a..cdf7c7e 100644 --- a/package.json +++ b/package.json @@ -14,20 +14,22 @@ }, "private": true, "dependencies": { - "@angular/common": "~2.0.0", - "@angular/compiler": "~2.0.0", - "@angular/core": "~2.0.0", - "@angular/forms": "~2.0.0", - "@angular/http": "~2.0.0", - "@angular/platform-browser": "~2.0.0", - "@angular/platform-browser-dynamic": "~2.0.0", - "@angular/router": "~3.0.0", + "@angular/common": "^2.1.0", + "@angular/compiler": "^2.1.0", + "@angular/core": "^2.1.0", + "@angular/forms": "^2.1.0", + "@angular/http": "^2.1.0", + "@angular/platform-browser": "^2.1.0", + "@angular/platform-browser-dynamic": "^2.1.0", + "@angular/platform-server": "^2.1.0", + "@angular/router": "^3.1.0", "core-js": "^2.4.1", "rxjs": "5.0.0-beta.12", - "ts-helpers": "^1.1.1", - "zone.js": "^0.6.23" + "ts-helpers": "^1.1.2", + "zone.js": "^0.6.25" }, "devDependencies": { + "@angular/compiler": "^2.1.0", "@types/jasmine": "^2.2.30", "@types/node": "^6.0.42", "angular-cli": "1.0.0-beta.17", diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 23369e4..27f08a3 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,11 +1,27 @@ import {NgModule} from '@angular/core'; -import {Routes, RouterModule} from '@angular/router'; +import {Routes, RouterModule, PreloadAllModules, ExtraOptions} from '@angular/router'; import {SimpleRouteComponent} from './simple-route/simple-route.component'; import {BundledModule} from './bundled/bundled.module'; export function loadBundledModule() { return BundledModule; } +// export function loadLazy() { +// return new Promise(function (resolve) { +// (require as any).ensure([], function (require: any) { +// resolve(require('./lazy/lazy.module.ngfactory')['LazyModuleNgFactory']); +// }); +// }); +// } + +export function loadLazy2() { + return new Promise(function (resolve) { + (require as any).ensure([], function (require: any) { + resolve(require('./lazy/lazy.module')['LazyModule']); + }); + }); +} + export const routes: Routes = [ { path: '', @@ -17,13 +33,18 @@ export const routes: Routes = [ loadChildren: loadBundledModule }, { - path: 'lazy', - loadChildren: './lazy/lazy.module#LazyModule' + path: '', + loadChildren: + './lazy/lazy.module#LazyModuleNgFactory' } ]; +// export const extraOptions = { +// preloadingStrategy: PreloadAllModules +// }; + @NgModule({ - imports: [RouterModule.forRoot(routes)], + imports: [RouterModule.forRoot(routes)], //, extraOptions)], exports: [RouterModule], providers: [] }) diff --git a/src/app/bundled/bundled-routing.module.ts b/src/app/bundled/bundled-routing.module.ts index 40b054b..eb1fc82 100644 --- a/src/app/bundled/bundled-routing.module.ts +++ b/src/app/bundled/bundled-routing.module.ts @@ -1,6 +1,5 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; -//import { BundledChildComponent } from './bundled-child/bundled-child.component'; import { BundledComponent } from './bundled.component'; export const routes: Routes = [ diff --git a/src/app/bundled/index.ts b/src/app/bundled/index.ts new file mode 100644 index 0000000..fef5727 --- /dev/null +++ b/src/app/bundled/index.ts @@ -0,0 +1,3 @@ +export * from './bundled.component'; +export * from './bundled-routing.module'; +export * from './bundled.module'; diff --git a/src/app/index.ts b/src/app/index.ts index 875bdb2..c9f2ddb 100644 --- a/src/app/index.ts +++ b/src/app/index.ts @@ -1,2 +1,4 @@ export * from './app.component'; +export * from './simple-route/simple-route.component'; +export * from './app-routing.module'; export * from './app.module'; diff --git a/src/app/lazy/index.ts b/src/app/lazy/index.ts new file mode 100644 index 0000000..7c73f06 --- /dev/null +++ b/src/app/lazy/index.ts @@ -0,0 +1,3 @@ +export * from './lazy.component'; +export * from './lazy-routing.module'; +export * from './lazy.module'; diff --git a/src/main.ts b/src/main.ts index 5c3c520..a58ebdb 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,7 +3,7 @@ import './polyfills.ts'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { enableProdMode } from '@angular/core'; import { environment } from './environments/environment'; -import { AppModule } from './app/'; +import { AppModule } from './app'; if (environment.production) { enableProdMode();