Created
July 30, 2014 16:33
-
-
Save spacenick/fc68438dfea71b9e4dc6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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('items', { | |
abstract: true, | |
url: "/items", | |
resolve :{ | |
items: ['DataSource', function(DataSource) { | |
return DataSource.fetchItems(); | |
}] | |
} | |
}) | |
.state('items.list', { | |
url: '', | |
controller: 'ListCtrl', | |
templateUrl: 'listTpl.html' | |
}) | |
.state('items.details', { | |
url: '/:itemId', | |
resolve: { | |
item: ['items', '$stateParams', function(items, $stateParams){ | |
// Puisque tu as déjà loadé toute la collection tu epux direct chopper l'objet | |
// Mais si tu veux tu peux faire une requête aussi (si tes objets sont pas complets par ex) | |
return items.find($stateParams.itemId); | |
}] | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment