Created
December 29, 2015 21:43
-
-
Save jack4it/1944110a602b335eb769 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export let app = angular.module("app", ["ui.router", "ct.ui.router.extras"]) | |
.service("SystemLazyLoadService", SystemLazyLoadService) | |
.config(["$stateProvider", "$urlRouterProvider", "$futureStateProvider", ($stateProvider, $urlRouterProvider, $futureStateProvider) => { | |
$stateProvider.state('home', { | |
url: "", | |
template: template | |
}); | |
$urlRouterProvider.otherwise(""); | |
$futureStateProvider.stateFactory("systemLazy", ["SystemLazyLoadService", "futureState", (loadService, futureState) => { | |
return loadService.load(futureState.src, futureState.moduleExportKey); | |
}]); | |
// These are the lazy module (future state) declarations | |
addSystemLazyState($futureStateProvider, "contact", "/contact", "contact/module.js", "contact"); | |
addSystemLazyState($futureStateProvider, "about", "/about", "about/module.js", "about"); | |
}]) | |
function addSystemLazyState($futureStateProvider, stateName, url, src, moduleExportKey) { | |
$futureStateProvider.futureState({ | |
stateName: stateName, | |
url: url, | |
type: "systemLazy", | |
src: src, | |
moduleExportKey: moduleExportKey | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment