Skip to content

Instantly share code, notes, and snippets.

@allyusd
Created August 7, 2014 08:23
Show Gist options
  • Save allyusd/5adf39fcb4efddf47c38 to your computer and use it in GitHub Desktop.
Save allyusd/5adf39fcb4efddf47c38 to your computer and use it in GitHub Desktop.
AngularJS - ui-router - app.js config
config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) {
//
// For any unmatched url, redirect to
$urlRouterProvider.otherwise("/main");
//
// Now set up the states
$stateProvider
.state('main', {
url: "/main",
templateUrl: "partials/main.html"
})
.state('main.view1', {
url: "/view1",
templateUrl: "partials/partial1.html",
controller: "MyCtrl1"
})
.state('main.view2', {
url: "/view2",
templateUrl: "partials/partial2.html",
controller: "MyCtrl2"
});
}])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment