Created
May 19, 2014 01:59
-
-
Save Hendrixer/3c01b66dc5d63f0fdb80 to your computer and use it in GitHub Desktop.
angular resolve
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
.config(['$routeProvider', function ($routeProvider) { | |
$routeProvider | |
.when('/', { | |
controller: 'mainController', | |
templateUrl: '/templates/main.html' | |
resolve: { | |
users: function(hrFactory) { | |
return hrFactory.get('/users').then(function(data){ | |
return data.data | |
}) | |
} | |
} | |
}); | |
}); | |
.controller('mainController', function ($scope, users) { | |
$scope.users = users; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment