-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathangular-simple-slideshow.min.js
1 lines (1 loc) · 1.52 KB
/
angular-simple-slideshow.min.js
1
var SlideShow=angular.module("simple-slideshow",["template/slideshow.html","template/slide.html"]);SlideShow.directive("slideshow",function(){return{scope:{},controller:["$scope","$element","$attrs","$transclude",function($scope){var ctrl=this,slides=ctrl.slides=$scope.slides=[];ctrl.addSlide=function(slide){slides.push(slide)},ctrl.select=function(slide){$scope.currentslide=slide}}],controllerAs:"slideshowCtrl",restrict:"AE",templateUrl:"template/slideshow.html",transclude:!0,link:function(){}}}),SlideShow.directive("slide",["$parse",function(){return{require:"^slideshow",restrict:"AE",templateUrl:"template/slide.html",transclude:!0,replace:!0,compile:function(){return{pre:function(scope,elm,attrs,slideshowCtrl){elm.on("click",function(){scope.$apply(scope.select(scope.slide))}),scope.select=function(slide){slideshowCtrl.select(slide)},slideshowCtrl.addSlide(scope.slide)},post:function(scope,elm,attrs,slideshowCtrl){slideshowCtrl.select(slideshowCtrl.slides[0])}}}}}]),angular.module("template/slideshow.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/slideshow.html",'<div class="slide-container"><div class="slide-image-wrap"><img class="slide-image" ng-src="{{currentslide.url}}" alt="{{currentslide.name}}" /><p>{{currentslide.name}}</p></div></div><div class="slides-wrap"><ul ng-transclude></ul></div>')}]),angular.module("template/slide.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/slide.html",'<li><a href><img ng-src="{{slide.url}}" /></a></li>')}]);