Created
July 27, 2015 14:47
-
-
Save mort3za/5860e9c0abf0a5bc2ffb to your computer and use it in GitHub Desktop.
UI-Router sample, With a root template and child views. Note that URL of homepage is `/` and root has no URL.
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
/* Setup Rounting For All Pages */ | |
SApp.config(['$stateProvider', '$locationProvider', '$httpProvider', '$urlRouterProvider', function($stateProvider, $locationProvider, $httpProvider, $urlRouterProvider) { | |
$httpProvider.defaults.withCredentials = false; | |
$locationProvider.html5Mode(true); | |
// Redirect any unmatched url | |
$urlRouterProvider.when('', '/'); | |
$urlRouterProvider.otherwise("/"); | |
// get app language | |
var current_lang = AppSettings.get().CURRENT_LANG; | |
$stateProvider | |
.state('root', { | |
templateUrl: "root." + current_lang + ".html", // e.g. root.en.html | |
controller: "AppController", | |
}) | |
// home | |
.state('root.home', { | |
url: "/", | |
views: { | |
'main-content': { | |
templateUrl: "main-content." + current_lang + ".html", | |
controller: "HomeMainContentController as hmcCtrl" | |
}, | |
'site-header': { | |
templateUrl: "site-header." + current_lang + ".html", | |
}, | |
'mega-menu': {} | |
} | |
}); | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment