# HG changeset patch # User cavaliet # Date 1412630048 -7200 # Node ID 9626048992255e358dc35b91c1e76ba2368c88d3 # Parent 824c87a9084cba64955e1d6dfcd18ceaf5eb8e2f search add works again diff -r 824c87a9084c -r 962604899225 client/app/slideshow/slideshow_controller.js --- a/client/app/slideshow/slideshow_controller.js Mon Oct 06 22:52:30 2014 +0200 +++ b/client/app/slideshow/slideshow_controller.js Mon Oct 06 23:14:08 2014 +0200 @@ -9,17 +9,9 @@ controller: 'slideshowCtrl' }); }) - /*.service('slideshowApi', function($resource, context) { - console.log('slideshow 5',this); - this.slideshow = $resource(context.urls.slideshowUrl); - })*/ .service('slideshowModel', function(searchApi) { console.log('slideshow 6',this); - /*this.slideshow = function(myVarForData){ - searchApi.searchResource({q:'stop_email=toto@gmail.com', of: 'json', synthesis: 'false', nresults:'50', callback: 'JSON_CALLBACK'}, myVarForData); - };*/ this.slideshow = searchApi.searchResource({q:'stop_email=toto@gmail.com', of: 'json', synthesis: 'false', nresults:'50', callback: 'JSON_CALLBACK'}).getJsonp(); - console.log('slideshow 6-2',this); }) .controller('slideshowCtrl', function($scope, $filter, $location, $routeParams, $timeout, searchApi, slideshowModel){ //console.log('slideshow 7', $location, $routeParams, searchApi); @@ -32,15 +24,12 @@ var a = $routeParams.searched.split(','); var q = a[0], i = parseInt(a[1]); if(a.length===2 && !isNaN(i)){ - searchApi.searchResource({q:q, of: 'json', synthesis: 'false', nresults:'50', callback: 'JSON_CALLBACK'}).$promise.then( + searchApi.searchResource({q:q, of: 'json', synthesis: 'false', nresults:'50', callback: 'JSON_CALLBACK'}).getJsonp().$promise.then( //success function( data ){ - var hit = data.hits[i]; - $scope.slideshow.images.push({url: $filter('meta')(hit.metas, 'url'), - title: $filter('meta')(hit.metas, 'name'), - description: $filter('meta')(hit.metas, 'description'), tags: [], user_title:'', user_description:''}); + $scope.slideshow.hits.push(data.hits[i]); // timeout because - $timeout(function(){$scope.slideshow.images[$scope.slideshow.images.length-1].active = true;}, 200); + $timeout(function(){$scope.slideshow.hits[$scope.slideshow.hits.length-1].active = true;}, 500); }, //error function( error ){