update slideshow : accept the id of a book as route parameter (instead of static id previously)
authorrougeronj
Fri, 03 Apr 2015 16:19:19 +0200
changeset 67 bc8fb175f4d9
parent 66 86f880fe5a25
child 68 b209b49c99fb
update slideshow : accept the id of a book as route parameter (instead of static id previously)
client/app/slideshow/slideshow_controller.js
--- a/client/app/slideshow/slideshow_controller.js	Fri Apr 03 15:06:42 2015 +0200
+++ b/client/app/slideshow/slideshow_controller.js	Fri Apr 03 16:19:19 2015 +0200
@@ -1,18 +1,11 @@
 (function(){
-  'use strict';
+	'use strict';
 
-  angular.module('ammicoSlideshow',['ngResource', 'ngRoute', 'ui.bootstrap'])
-    .config(function ($routeProvider) {
-      $routeProvider
-        .when('/', {
-          templateUrl: 'slideshow/slideshow.html',
-          controller: 'slideshowCtrl'
-        });
-    })
-    .controller('slideshowCtrl', function($scope, ammicoApi){
-    	$scope.slideshow = ammicoApi.booksSlides.query({idBook:'12', format:'json'}, function(data){
-    		data = ammicoApi.sanitizeUrls(data);
-    	});
-    	$scope.book = ammicoApi.book.get({idBook:'12', format:'json'});
-    });
+	angular.module('ammicoSlideshow',['ngResource', 'ngRoute', 'ui.bootstrap'])
+	.controller('slideshowCtrl', function($scope, ammicoApi, $routeParams){
+		$scope.slideshow = ammicoApi.booksSlides.query({idBook:$routeParams.iSlide, format:'json'}, function(data){
+			data = ammicoApi.sanitizeUrls(data);
+		});
+		$scope.book = ammicoApi.book.get({idBook:$routeParams.iSlide, format:'json'});
+	});
 })();