Skip to content

Instantly share code, notes, and snippets.

@janv
Last active December 24, 2015 21:09
Show Gist options
  • Save janv/6863440 to your computer and use it in GitHub Desktop.
Save janv/6863440 to your computer and use it in GitHub Desktop.
angular.module('ngViewExample', ['ngRoute', 'ngAnimate'], function($routeProvider, $locationProvider) {
$routeProvider.when('/Book/:bookId', {
templateUrl: 'book.html',
controller: BookCntl,
resolve: {
book: function(BookResource, $route){
return BookResource.get({bookId: $route.current.params.bookId});
}
}
});
});
angular.module('ngViewExample').factory('BookResource', function($resource){
return $resource('/books/:bookId.json');
})
function BookCntl($scope, $routeParams, book) {
$scope.book = book;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment