Skip to content

Instantly share code, notes, and snippets.

@icfantv
Created February 12, 2016 20:23
Show Gist options
  • Save icfantv/81a87f36cc4d4fd2129b to your computer and use it in GitHub Desktop.
Save icfantv/81a87f36cc4d4fd2129b to your computer and use it in GitHub Desktop.
Sample Route Provider
export function SampleRouteConfiguration($routeProvider) {
$routeProvider.when('/customer', {
controller: 'CustomerListController',
controllerAs: 'customers',
templateUrl: 'path/to/customers.html',
resolve: {
consumers: ['CustomerService', CustomerService => CustomerService.getAll()]
}
}).when('/customer/:id', {
controller: 'CustomerController',
controllerAs: 'customer',
templateUrl: 'path/to/customer.html',
resolve: {
consumer: ['$route', 'CustomerService', ($route, CustomerService) => CustomerService.get($route.current.params.id)]
}
});
}
SampleRouteConfiguration.$inject = ['$routeProvider'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment