Created
January 18, 2015 01:28
-
-
Save panda4man/dd173cd3692dc3bcea13 to your computer and use it in GitHub Desktop.
Ionic Route Example
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
$stateProvider | |
.state('app', { | |
url: "/app", | |
abstract: true, | |
controller: 'MainCtrl', | |
templateUrl: "templates/tabs.html", | |
resolve: { | |
Migrations: ['$q', 'InitService', function($q, Init) { | |
return Init.promise.then(function(good) { | |
return good; | |
}, function(err) { | |
return err; | |
}); | |
}] | |
} | |
}) | |
.state('app.classes', { | |
url: "/classes/:id/:name/:year", | |
cache: false, | |
views: { | |
'tab-gradebook': { | |
templateUrl: "templates/classes.html", | |
controller: 'ClassesCtrl', | |
resolve: { | |
Classes: function(ClassFactory, $stateParams) { | |
return ClassFactory.all($stateParams.id).then(function(c) { | |
return c; | |
}, function(fail) { | |
console.log(fail); | |
return []; | |
}); | |
} | |
} | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment