Skip to content

Commit

Permalink
Add all ezp callback methods as directive attributes with syntax ezp-…
Browse files Browse the repository at this point in the history
…on-XXX

Version bump.
  • Loading branch information
Igor Lino committed Jun 7, 2015
1 parent 5c583fe commit 152d307
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 5 deletions.
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-ez-plus",
"version": "1.0.6",
"version": "1.0.7",
"author": {
"name": "Igor Lino",
"url": "http://igorlino.github.io/angular-elevatezoom-plus/"
Expand Down Expand Up @@ -28,7 +28,7 @@
"dependencies": {
"jquery": "~2.1.1",
"angular": "~1.3.4",
"ez-plus": "~1.1.3"
"ez-plus": "~1.1.4"
},
"devDependencies": {
},
Expand Down
48 changes: 46 additions & 2 deletions js/ezplus.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@
restrict: 'A',
scope: {
ezpModel: '=',
ezpOptions: '='
ezpOptions: '=',
onComplete: '=ezpOnComplete',
onDestroy: '=ezpOnDestroy',
onImageClick: '=ezpOnImageClick',
onImageSwap: '=ezpOnImageSwap',
onImageSwapComplete: '=ezpOnImageSwapComplete',
onShow: '=ezpOnShow',
onZoomedImageLoaded: '=ezpOnZoomedImageLoaded'
},
link: link
};
Expand All @@ -19,7 +26,44 @@

link.$inject = ['$scope', '$element', '$attributes'];
function link($scope, $element, $attributes) {
var options = {};
var options = {
onComplete: function () {
if ($scope.onComplete()) {
$scope.onComplete()();
}
},
onDestroy: function () {
if ($scope.onDestroy()) {
$scope.onDestroy()();
}
},
onImageClick: function () {
if ($scope.onImageClick()) {
$scope.onImageClick()();
}
},

onImageSwap: function () {
if ($scope.onImageSwap()) {
$scope.onImageSwap()();
}
},
onImageSwapComplete: function () {
if ($scope.onImageSwapComplete()) {
$scope.onImageSwapComplete()();
}
},
onShow: function () {
if ($scope.onShow()) {
$scope.onShow()();
}
},
onZoomedImageLoaded: function () {
if ($scope.onZoomedImageLoaded()) {
$scope.onZoomedImageLoaded()();
}
}
};

//generic way that sets all (non-function) parameters of elevate zoom plus.
if ($scope.ezpOptions) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-ez-plus",
"version": "1.0.6",
"version": "1.0.7",
"title": "Angular EZ Plus",
"description": "Angular directive for ElevateZoom Plus.",
"keywords": [
Expand Down

0 comments on commit 152d307

Please sign in to comment.