From e7540d0037607578d111666517fa75575fdb3556 Mon Sep 17 00:00:00 2001 From: Murat Yukselen Date: Thu, 21 Apr 2016 17:34:58 +0300 Subject: [PATCH 1/5] improved Swiper lifecycle by properly destroying it improved pagination selection after angular linking. Works without UUIDs. Added new demo from Swiper that shows how to sync slides. --- README.md | 8 +- bower.json | 53 ++++++------ demos/11b-nested-and-synced.html | 140 +++++++++++++++++++++++++++++++ src/angular-swiper.js | 22 ++++- 4 files changed, 191 insertions(+), 32 deletions(-) create mode 100644 demos/11b-nested-and-synced.html diff --git a/README.md b/README.md index 107f8c5..0e75ed5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # angular-swiper -Directive that wraps nolimits4web/swiper library for AngularJS. +Directive that wraps [nolimits4web/swiper](https://github.com/nolimits4web/swiper) library for AngularJS. License: Apache ## 1 Installation @@ -23,7 +23,7 @@ Add ` @@ -152,9 +152,9 @@ angular.module('swiperApp') $scope.swiper = {}; $scope.onReadySwiper = function (swiper) { - + swiper.on('slideChangeStart', function () { - + console.log('slideChangeStart'); }); }; diff --git a/bower.json b/bower.json index 0542c6f..fe56811 100644 --- a/bower.json +++ b/bower.json @@ -1,26 +1,29 @@ { - "name": "angular-swiper", - "version": "0.3.2", - "homepage": "https://github.com/ksachdeva/angular-swiper", - "authors": [ - "Kapil Sachdeva " - ], - "description": "Angular directive for nolimits4web/Swiper javascript library", - "main": "dist/angular-swiper.js", - "keywords": [ - "angular", - "swiper" - ], - "license": "Apache", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests" - ], - "dependencies": { - "swiper": "~3.0.5", - "angular": ">=1.3" - } -} \ No newline at end of file + "name": "angular-swiper", + "version": "0.3.3", + "homepage": "https://github.com/ksachdeva/angular-swiper", + "authors": [ + "Kapil Sachdeva " + ], + "description": "Angular directive for nolimits4web/Swiper javascript library", + "main": "dist/angular-swiper.js", + "keywords": [ + "angular", + "swiper" + ], + "license": "Apache", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ], + "dependencies": { + "swiper": "~3.3.1", + "angular": ">=1.3" + }, + "devDependencies": { + "jquery": "^2.2.3" + } +} diff --git a/demos/11b-nested-and-synced.html b/demos/11b-nested-and-synced.html new file mode 100644 index 0000000..2017978 --- /dev/null +++ b/demos/11b-nested-and-synced.html @@ -0,0 +1,140 @@ + + + + + + Simple + + + + + + + + + +
+ + Destroy? +
+
+

1

+
+ + + Slide {{s}} + + + +
+

2

+
+ + + + + Horizontal {{h}} + Slide {{s}} + + + + + +
+
+
+
+ + + + + + + + + + + diff --git a/src/angular-swiper.js b/src/angular-swiper.js index e57492e..a40e8ce 100644 --- a/src/angular-swiper.js +++ b/src/angular-swiper.js @@ -42,6 +42,7 @@ initialSlide: '=', containerCls: '@', wrapperCls: '@', + pagination: '@', paginationCls: '@', slideCls: '@', direction: '@', @@ -50,6 +51,7 @@ }, controller: function($scope, $element, $timeout) { var uuid = createUUID(); + var swiperInstance; $scope.swiper_uuid = uuid; @@ -61,7 +63,8 @@ direction: $scope.direction || 'horizontal', loop: $scope.loop || false, initialSlide: $scope.initialSlide || 0, - showNavButtons: false + showNavButtons: false, + pagination: $scope.pagination }; if (!angular.isUndefined($scope.autoplay) && typeof $scope.autoplay === 'number') { @@ -73,7 +76,7 @@ if ($scope.paginationIsActive === true) { params = angular.extend({}, params, { paginationClickable: $scope.paginationClickable || true, - pagination: '#paginator-' + $scope.swiper_uuid + pagination: $scope.pagination || '#paginator-' + $scope.swiper_uuid }); } @@ -90,9 +93,16 @@ params = angular.extend({}, params, $scope.overrideParameters); } + //delay Swiper creation after linking $timeout(function() { var swiper = null; + //find HTMLElements for pagination + if (angular.isString(params.pagination)) { + //if we do not convert here, Swiper will search all the DOM + params.pagination = $(params.pagination, $element[0].firstChild); + } + if (angular.isObject($scope.swiper)) { $scope.swiper = new Swiper($element[0].firstChild, params); swiper = $scope.swiper; @@ -100,6 +110,8 @@ swiper = new Swiper($element[0].firstChild, params); } + swiperInstance = swiper; //MYN TODO make this controller local variable + //If specified, calls this function when the swiper object is available if (!angular.isUndefined($scope.onReady)) { $scope.onReady({ @@ -107,6 +119,10 @@ }); } }); + + $scope.$on('$destroy', function () { + swiperInstance.destroy(true); + }); }, link: function(scope, element) { @@ -155,4 +171,4 @@ }; } -})(window, angular, undefined); \ No newline at end of file +})(window, angular, undefined); From 9220345bb01c92ee43bebe827bf0a888df35a840 Mon Sep 17 00:00:00 2001 From: Murat Yukselen Date: Thu, 21 Apr 2016 19:08:23 +0300 Subject: [PATCH 2/5] generated distribution --- dist/angular-swiper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/angular-swiper.js b/dist/angular-swiper.js index 9d086c4..0b68963 100644 --- a/dist/angular-swiper.js +++ b/dist/angular-swiper.js @@ -1 +1 @@ -!function(e,i,r){"use strict";function t(){for(var e=[],i="0123456789abcdef",r=0;36>r;r++)e[r]=i.substr(Math.floor(16*Math.random()),1);e[14]="4",e[19]=i.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-";var t=e.join("");return t}function a(){return{restrict:"E",transclude:!0,scope:{onReady:"&",slidesPerView:"=",slidesPerColumn:"=",spaceBetween:"=",parallax:"=",parallaxTransition:"@",paginationIsActive:"=",paginationClickable:"=",showNavButtons:"=",showScrollBar:"=",loop:"=",autoplay:"=",initialSlide:"=",containerCls:"@",wrapperCls:"@",paginationCls:"@",slideCls:"@",direction:"@",swiper:"=",overrideParameters:"="},controller:["$scope","$element","$timeout",function(e,r,a){var n=t();e.swiper_uuid=n;var s={slidesPerView:e.slidesPerView||1,slidesPerColumn:e.slidesPerColumn||1,spaceBetween:e.spaceBetween||0,direction:e.direction||"horizontal",loop:e.loop||!1,initialSlide:e.initialSlide||0,showNavButtons:!1};i.isUndefined(e.autoplay)||"number"!=typeof e.autoplay||(s=i.extend({},s,{autoplay:e.autoplay})),e.paginationIsActive===!0&&(s=i.extend({},s,{paginationClickable:e.paginationClickable||!0,pagination:"#paginator-"+e.swiper_uuid})),e.showNavButtons===!0&&(s.nextButton="#nextButton-"+e.swiper_uuid,s.prevButton="#prevButton-"+e.swiper_uuid),e.showScrollBar===!0&&(s.scrollbar="#scrollBar-"+e.swiper_uuid),e.overrideParameters&&(s=i.extend({},s,e.overrideParameters)),a(function(){var t=null;i.isObject(e.swiper)?(e.swiper=new Swiper(r[0].firstChild,s),t=e.swiper):t=new Swiper(r[0].firstChild,s),i.isUndefined(e.onReady)||e.onReady({swiper:t})})}],link:function(e,r){var t=e.swiper_uuid,a="paginator-"+t,n="prevButton-"+t,s="nextButton-"+t,o="scrollBar-"+t,l=r[0];i.element(l.querySelector(".swiper-pagination")).attr("id",a),i.element(l.querySelector(".swiper-button-next")).attr("id",s),i.element(l.querySelector(".swiper-button-prev")).attr("id",n),i.element(r[0].querySelector(".swiper-scrollbar")).attr("id",o)},template:'
'}}function n(){return{restrict:"E",require:"^ksSwiperContainer",transclude:!0,template:'
',replace:!0}}i.module("ksSwiper",[]).directive("ksSwiperContainer",a).directive("ksSwiperSlide",n)}(window,angular,void 0); \ No newline at end of file +!function(e,i,r){"use strict";function t(){for(var e=[],i="0123456789abcdef",r=0;36>r;r++)e[r]=i.substr(Math.floor(16*Math.random()),1);e[14]="4",e[19]=i.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-";var t=e.join("");return t}function a(){return{restrict:"E",transclude:!0,scope:{onReady:"&",slidesPerView:"=",slidesPerColumn:"=",spaceBetween:"=",parallax:"=",parallaxTransition:"@",paginationIsActive:"=",paginationClickable:"=",showNavButtons:"=",showScrollBar:"=",loop:"=",autoplay:"=",initialSlide:"=",containerCls:"@",wrapperCls:"@",pagination:"@",paginationCls:"@",slideCls:"@",direction:"@",swiper:"=",overrideParameters:"="},controller:["$scope","$element","$timeout",function(e,r,a){var n,s=t();e.swiper_uuid=s;var o={slidesPerView:e.slidesPerView||1,slidesPerColumn:e.slidesPerColumn||1,spaceBetween:e.spaceBetween||0,direction:e.direction||"horizontal",loop:e.loop||!1,initialSlide:e.initialSlide||0,showNavButtons:!1,pagination:e.pagination};i.isUndefined(e.autoplay)||"number"!=typeof e.autoplay||(o=i.extend({},o,{autoplay:e.autoplay})),e.paginationIsActive===!0&&(o=i.extend({},o,{paginationClickable:e.paginationClickable||!0,pagination:e.pagination||"#paginator-"+e.swiper_uuid})),e.showNavButtons===!0&&(o.nextButton="#nextButton-"+e.swiper_uuid,o.prevButton="#prevButton-"+e.swiper_uuid),e.showScrollBar===!0&&(o.scrollbar="#scrollBar-"+e.swiper_uuid),e.overrideParameters&&(o=i.extend({},o,e.overrideParameters)),a(function(){var t=null;i.isString(o.pagination)&&(o.pagination=$(o.pagination,r[0].firstChild)),i.isObject(e.swiper)?(e.swiper=new Swiper(r[0].firstChild,o),t=e.swiper):t=new Swiper(r[0].firstChild,o),n=t,i.isUndefined(e.onReady)||e.onReady({swiper:t})}),e.$on("$destroy",function(){n.destroy(!0)})}],link:function(e,r){var t=e.swiper_uuid,a="paginator-"+t,n="prevButton-"+t,s="nextButton-"+t,o="scrollBar-"+t,l=r[0];i.element(l.querySelector(".swiper-pagination")).attr("id",a),i.element(l.querySelector(".swiper-button-next")).attr("id",s),i.element(l.querySelector(".swiper-button-prev")).attr("id",n),i.element(r[0].querySelector(".swiper-scrollbar")).attr("id",o)},template:'
'}}function n(){return{restrict:"E",require:"^ksSwiperContainer",transclude:!0,template:'
',replace:!0}}i.module("ksSwiper",[]).directive("ksSwiperContainer",a).directive("ksSwiperSlide",n)}(window,angular,void 0); \ No newline at end of file From e1fa40e6cc7f12b56e237e6a7a94d1eb0e732d53 Mon Sep 17 00:00:00 2001 From: Murat Yukselen Date: Fri, 22 Apr 2016 10:15:44 +0300 Subject: [PATCH 3/5] added Swiper:keyboardControl support --- demos/11c-nested-synced-keyboard.html | 152 ++++++++++++++++++++++++++ src/angular-swiper.js | 2 + 2 files changed, 154 insertions(+) create mode 100644 demos/11c-nested-synced-keyboard.html diff --git a/demos/11c-nested-synced-keyboard.html b/demos/11c-nested-synced-keyboard.html new file mode 100644 index 0000000..1a5528e --- /dev/null +++ b/demos/11c-nested-synced-keyboard.html @@ -0,0 +1,152 @@ + + + + + + Simple + + + + + + + + + +
+ + Destroy? +
+
+

1

+
+ + + Slide {{s}} + + + +
+

2

+
+ + + + + {{slide}} + + + + + +
+
+
+
+ + + + + + + + + + + diff --git a/src/angular-swiper.js b/src/angular-swiper.js index a40e8ce..e29cf27 100644 --- a/src/angular-swiper.js +++ b/src/angular-swiper.js @@ -37,6 +37,7 @@ paginationClickable: '=', showNavButtons: '=', showScrollBar: '=', + keyboardControl: '@', loop: '=', autoplay: '=', initialSlide: '=', @@ -61,6 +62,7 @@ slidesPerColumn: $scope.slidesPerColumn || 1, spaceBetween: $scope.spaceBetween || 0, direction: $scope.direction || 'horizontal', + keyboardControl: $scope.keyboardControl || false, loop: $scope.loop || false, initialSlide: $scope.initialSlide || 0, showNavButtons: false, From 7e9de208690f9c0237c5d6e95c0d111abb5883de Mon Sep 17 00:00:00 2001 From: Murat Yukselen Date: Fri, 22 Apr 2016 11:20:15 +0300 Subject: [PATCH 4/5] WIP, dynamic slide adding --- demos/11d-dynamic-grid.html | 171 ++++++++++++++++++++++++++++++++++++ src/angular-swiper.js | 29 +++++- 2 files changed, 198 insertions(+), 2 deletions(-) create mode 100644 demos/11d-dynamic-grid.html diff --git a/demos/11d-dynamic-grid.html b/demos/11d-dynamic-grid.html new file mode 100644 index 0000000..f498179 --- /dev/null +++ b/demos/11d-dynamic-grid.html @@ -0,0 +1,171 @@ + + + + + + Simple + + + + + + + + + +
+ + + +
+
+

1

+
+ + + Slide {{s}} + + + +
+

2

+
+ + + + + {{slide}} + + + + + +
+
+
+
+ + + + + + + + + + + diff --git a/src/angular-swiper.js b/src/angular-swiper.js index e29cf27..4cc2cbd 100644 --- a/src/angular-swiper.js +++ b/src/angular-swiper.js @@ -124,7 +124,27 @@ $scope.$on('$destroy', function () { swiperInstance.destroy(true); + console.log('controller destroyed'); }); + console.log('controller created'); + + function newSlideLinked(iElement) { + if (swiperInstance !== undefined) { + //check for prepend + //element has index in $scope.$index + var newElementIndex = iElement.scope().$index; + if (newElementIndex <= swiperInstance.activeIndex) { + //we have a new prepended slide + swiperInstance.slideNext(false, 0); + } + swiperInstance.update(); //updateTranslate defaults to false + console.log('Linked slide: ', iElement); + } + } + + return { + newSlideLinked: newSlideLinked + } }, link: function(scope, element) { @@ -149,6 +169,7 @@ angular.element(element[0].querySelector('.swiper-scrollbar')) .attr('id', scrollBarId); + console.log('link complete'); }, template: '
' + @@ -158,7 +179,8 @@ '
' + '
' + '
' + - '
' + '', + replace: false //so do not forget to add CSS class for this directive tag }; } @@ -169,7 +191,10 @@ require: '^ksSwiperContainer', transclude: true, template: '
', - replace: true + replace: true, + link: function link(scope, iElement, iAttrs, controller) { + controller.newSlideLinked(iElement); + } }; } From 0c33a356de53e0e83cb3bd73f47beb4564af1cd5 Mon Sep 17 00:00:00 2001 From: Murat Yukselen Date: Fri, 22 Apr 2016 13:56:25 +0300 Subject: [PATCH 5/5] dynamic grid example improved --- demos/11d-dynamic-grid.html | 21 +++++++++++++++++++-- dist/angular-swiper.js | 2 +- src/angular-swiper.js | 6 +----- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/demos/11d-dynamic-grid.html b/demos/11d-dynamic-grid.html index f498179..2059201 100644 --- a/demos/11d-dynamic-grid.html +++ b/demos/11d-dynamic-grid.html @@ -50,6 +50,7 @@ +

1

@@ -103,7 +104,7 @@

2

module.controller('SyncedSwipersCtrl', function($scope) { $scope.syncedSwipers = { swipers: [], - index: 0 + index: -1 }; var onSlideChangeEnd = function(swiper) { console.log('slide changed to', swiper.activeIndex); @@ -120,7 +121,12 @@

2

$scope.syncedSwipers.addSwiper = function(swiper) { $scope.syncedSwipers.swipers.push(swiper); swiper.on('onSlideChangeEnd', onSlideChangeEnd); - $scope.syncedSwipers.index = swiper.activeIndex; + if ($scope.syncedSwipers.index < 0) { + $scope.syncedSwipers.index = swiper.activeIndex; + } else { + //hello new swiper + swiper.slideTo($scope.syncedSwipers.index, 0, false); + } }; $scope.syncedSwipers.onReadySwiper = function(swiper) { $scope.syncedSwipers.addSwiper(swiper); @@ -163,6 +169,17 @@

2

} console.log('appended'); } + $scope.appendGroup = function() { + var slideNum = $scope.grid.groups[0].length; + var groupName = $scope.grid.groups.length; + var group = []; + for(var i = 0; i < slideNum; ++i) { + var name = '(New) Group: ' + groupName + ', Slide: ' + i; + group.push(name); + } + $scope.grid.groups.push(group); + console.log('group appended'); + } }); diff --git a/dist/angular-swiper.js b/dist/angular-swiper.js index 0b68963..99dd398 100644 --- a/dist/angular-swiper.js +++ b/dist/angular-swiper.js @@ -1 +1 @@ -!function(e,i,r){"use strict";function t(){for(var e=[],i="0123456789abcdef",r=0;36>r;r++)e[r]=i.substr(Math.floor(16*Math.random()),1);e[14]="4",e[19]=i.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-";var t=e.join("");return t}function a(){return{restrict:"E",transclude:!0,scope:{onReady:"&",slidesPerView:"=",slidesPerColumn:"=",spaceBetween:"=",parallax:"=",parallaxTransition:"@",paginationIsActive:"=",paginationClickable:"=",showNavButtons:"=",showScrollBar:"=",loop:"=",autoplay:"=",initialSlide:"=",containerCls:"@",wrapperCls:"@",pagination:"@",paginationCls:"@",slideCls:"@",direction:"@",swiper:"=",overrideParameters:"="},controller:["$scope","$element","$timeout",function(e,r,a){var n,s=t();e.swiper_uuid=s;var o={slidesPerView:e.slidesPerView||1,slidesPerColumn:e.slidesPerColumn||1,spaceBetween:e.spaceBetween||0,direction:e.direction||"horizontal",loop:e.loop||!1,initialSlide:e.initialSlide||0,showNavButtons:!1,pagination:e.pagination};i.isUndefined(e.autoplay)||"number"!=typeof e.autoplay||(o=i.extend({},o,{autoplay:e.autoplay})),e.paginationIsActive===!0&&(o=i.extend({},o,{paginationClickable:e.paginationClickable||!0,pagination:e.pagination||"#paginator-"+e.swiper_uuid})),e.showNavButtons===!0&&(o.nextButton="#nextButton-"+e.swiper_uuid,o.prevButton="#prevButton-"+e.swiper_uuid),e.showScrollBar===!0&&(o.scrollbar="#scrollBar-"+e.swiper_uuid),e.overrideParameters&&(o=i.extend({},o,e.overrideParameters)),a(function(){var t=null;i.isString(o.pagination)&&(o.pagination=$(o.pagination,r[0].firstChild)),i.isObject(e.swiper)?(e.swiper=new Swiper(r[0].firstChild,o),t=e.swiper):t=new Swiper(r[0].firstChild,o),n=t,i.isUndefined(e.onReady)||e.onReady({swiper:t})}),e.$on("$destroy",function(){n.destroy(!0)})}],link:function(e,r){var t=e.swiper_uuid,a="paginator-"+t,n="prevButton-"+t,s="nextButton-"+t,o="scrollBar-"+t,l=r[0];i.element(l.querySelector(".swiper-pagination")).attr("id",a),i.element(l.querySelector(".swiper-button-next")).attr("id",s),i.element(l.querySelector(".swiper-button-prev")).attr("id",n),i.element(r[0].querySelector(".swiper-scrollbar")).attr("id",o)},template:'
'}}function n(){return{restrict:"E",require:"^ksSwiperContainer",transclude:!0,template:'
',replace:!0}}i.module("ksSwiper",[]).directive("ksSwiperContainer",a).directive("ksSwiperSlide",n)}(window,angular,void 0); \ No newline at end of file +!function(e,i,r){"use strict";function n(){for(var e=[],i="0123456789abcdef",r=0;36>r;r++)e[r]=i.substr(Math.floor(16*Math.random()),1);e[14]="4",e[19]=i.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-";var n=e.join("");return n}function t(){return{restrict:"E",transclude:!0,scope:{onReady:"&",slidesPerView:"=",slidesPerColumn:"=",spaceBetween:"=",parallax:"=",parallaxTransition:"@",paginationIsActive:"=",paginationClickable:"=",showNavButtons:"=",showScrollBar:"=",keyboardControl:"@",loop:"=",autoplay:"=",initialSlide:"=",containerCls:"@",wrapperCls:"@",pagination:"@",paginationCls:"@",slideCls:"@",direction:"@",swiper:"=",overrideParameters:"="},controller:["$scope","$element","$timeout",function(e,t,a){function o(e){if(s!==r){var i=e.scope().$index;i<=s.activeIndex&&s.slideNext(!1,0),s.update()}}var s,l=n();e.swiper_uuid=l;var p={slidesPerView:e.slidesPerView||1,slidesPerColumn:e.slidesPerColumn||1,spaceBetween:e.spaceBetween||0,direction:e.direction||"horizontal",keyboardControl:e.keyboardControl||!1,loop:e.loop||!1,initialSlide:e.initialSlide||0,showNavButtons:!1,pagination:e.pagination};return i.isUndefined(e.autoplay)||"number"!=typeof e.autoplay||(p=i.extend({},p,{autoplay:e.autoplay})),e.paginationIsActive===!0&&(p=i.extend({},p,{paginationClickable:e.paginationClickable||!0,pagination:e.pagination||"#paginator-"+e.swiper_uuid})),e.showNavButtons===!0&&(p.nextButton="#nextButton-"+e.swiper_uuid,p.prevButton="#prevButton-"+e.swiper_uuid),e.showScrollBar===!0&&(p.scrollbar="#scrollBar-"+e.swiper_uuid),e.overrideParameters&&(p=i.extend({},p,e.overrideParameters)),a(function(){var r=null;i.isString(p.pagination)&&(p.pagination=$(p.pagination,t[0].firstChild)),i.isObject(e.swiper)?(e.swiper=new Swiper(t[0].firstChild,p),r=e.swiper):r=new Swiper(t[0].firstChild,p),s=r,i.isUndefined(e.onReady)||e.onReady({swiper:r})}),e.$on("$destroy",function(){s.destroy(!0)}),{newSlideLinked:o}}],link:function(e,r){var n=e.swiper_uuid,t="paginator-"+n,a="prevButton-"+n,o="nextButton-"+n,s="scrollBar-"+n,l=r[0];i.element(l.querySelector(".swiper-pagination")).attr("id",t),i.element(l.querySelector(".swiper-button-next")).attr("id",o),i.element(l.querySelector(".swiper-button-prev")).attr("id",a),i.element(r[0].querySelector(".swiper-scrollbar")).attr("id",s)},template:'
',replace:!1}}function a(){return{restrict:"E",require:"^ksSwiperContainer",transclude:!0,template:'
',replace:!0,link:function(e,i,r,n){n.newSlideLinked(i)}}}i.module("ksSwiper",[]).directive("ksSwiperContainer",t).directive("ksSwiperSlide",a)}(window,angular,void 0); \ No newline at end of file diff --git a/src/angular-swiper.js b/src/angular-swiper.js index 4cc2cbd..8bb672d 100644 --- a/src/angular-swiper.js +++ b/src/angular-swiper.js @@ -112,7 +112,7 @@ swiper = new Swiper($element[0].firstChild, params); } - swiperInstance = swiper; //MYN TODO make this controller local variable + swiperInstance = swiper; //If specified, calls this function when the swiper object is available if (!angular.isUndefined($scope.onReady)) { @@ -124,9 +124,7 @@ $scope.$on('$destroy', function () { swiperInstance.destroy(true); - console.log('controller destroyed'); }); - console.log('controller created'); function newSlideLinked(iElement) { if (swiperInstance !== undefined) { @@ -138,7 +136,6 @@ swiperInstance.slideNext(false, 0); } swiperInstance.update(); //updateTranslate defaults to false - console.log('Linked slide: ', iElement); } } @@ -169,7 +166,6 @@ angular.element(element[0].querySelector('.swiper-scrollbar')) .attr('id', scrollBarId); - console.log('link complete'); }, template: '
' +