| author | rougeronj |
| Tue, 24 Mar 2015 17:46:53 +0100 | |
| changeset 37 | 81ed4fbb1a64 |
| parent 31 | 8d016c195d79 |
| child 40 | 4b3bebe4355d |
| permissions | -rw-r--r-- |
| 0 | 1 |
(function(){ |
|
31
8d016c195d79
get info of a slide and show it. Sanitize html from description field and add it to the scope
rougeronj
parents:
26
diff
changeset
|
2 |
'use strict'; |
| 0 | 3 |
|
|
31
8d016c195d79
get info of a slide and show it. Sanitize html from description field and add it to the scope
rougeronj
parents:
26
diff
changeset
|
4 |
angular.module('ammicoSlides',['ngResource', 'ngRoute']) |
|
8d016c195d79
get info of a slide and show it. Sanitize html from description field and add it to the scope
rougeronj
parents:
26
diff
changeset
|
5 |
.controller('slidesCtrl', function($scope, $routeParams, searchApi, $sce){ |
| 37 | 6 |
|
|
31
8d016c195d79
get info of a slide and show it. Sanitize html from description field and add it to the scope
rougeronj
parents:
26
diff
changeset
|
7 |
$scope.slide = searchApi.slide.get({idSlide:$routeParams.idSlide, format:'json'}, function(data){ |
|
8d016c195d79
get info of a slide and show it. Sanitize html from description field and add it to the scope
rougeronj
parents:
26
diff
changeset
|
8 |
data.details.description = $sce.trustAsHtml(data.details.description); |
|
8d016c195d79
get info of a slide and show it. Sanitize html from description field and add it to the scope
rougeronj
parents:
26
diff
changeset
|
9 |
}); |
| 37 | 10 |
|
11 |
$scope.save = function(){ |
|
12 |
$scope.slide.$save({idSlide:$routeParams.idSlide, format:'json'}); |
|
13 |
}; |
|
14 |
||
|
31
8d016c195d79
get info of a slide and show it. Sanitize html from description field and add it to the scope
rougeronj
parents:
26
diff
changeset
|
15 |
}) |
| 37 | 16 |
.directive('slideEditor', function() { |
17 |
return { |
|
18 |
restrict: 'AE', |
|
19 |
replace: true, |
|
20 |
scope: false, |
|
21 |
templateUrl: 'slides/dataEditor.html', |
|
22 |
controller: function($scope){ |
|
23 |
$scope.slidesave = function(){ |
|
24 |
if(typeof $scope.slide.tags === 'string'){ |
|
25 |
$scope.slide.tags = $scope.slide.tags.split(','); |
|
26 |
} |
|
27 |
for (var i = $scope.slide.tags.length - 1; i >= 0; i--) { |
|
28 |
$scope.slide.tags[i] = $scope.slide.tags[i].trim(); |
|
29 |
} |
|
30 |
$scope.slide.editMode = false; |
|
31 |
$scope.save(); |
|
32 |
}; |
|
33 |
} |
|
34 |
}; |
|
|
31
8d016c195d79
get info of a slide and show it. Sanitize html from description field and add it to the scope
rougeronj
parents:
26
diff
changeset
|
35 |
}); |
| 0 | 36 |
|
37 |
})(); |