From bc23d793430fd091e6e3f8dc27f137d79742c708 Mon Sep 17 00:00:00 2001 From: Ashish Shubham Date: Tue, 5 Apr 2016 22:46:19 -0700 Subject: [PATCH 1/2] Added Start/End callbacks. Added callback support for those who might not want to use broadcasted events. --- src/angular-resizable.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/angular-resizable.js b/src/angular-resizable.js index 22866f2..6815e38 100644 --- a/src/angular-resizable.js +++ b/src/angular-resizable.js @@ -23,7 +23,9 @@ angular.module('angularResizable', []) rFlex: '=', rGrabber: '@', rDisabled: '@', - rNoThrottle: '=' + rNoThrottle: '=', + rEnd: '&', + rStart: '&' }, link: function(scope, element, attr) { var flexBasis = 'flexBasis' in document.documentElement.style ? 'flexBasis' : @@ -103,6 +105,9 @@ angular.module('angularResizable', []) var dragEnd = function(e) { updateInfo(); scope.$emit('angular-resizable.resizeEnd', info); + if(angular.isFunction(scope.rEnd)) { + scope.rEnd({info:info}); + } scope.$apply(); document.removeEventListener('mouseup', dragEnd, false); document.removeEventListener('mousemove', dragging, false); @@ -133,6 +138,9 @@ angular.module('angularResizable', []) updateInfo(e); scope.$emit('angular-resizable.resizeStart', info); + if(angular.isFunction(scope.rStart)) { + scope.rStart({info:info}); + } scope.$apply(); }; From 070697ae2f3dfeda38ff85fd8baed3601bd3f767 Mon Sep 17 00:00:00 2001 From: Ashish Shubham Date: Tue, 5 Apr 2016 22:51:03 -0700 Subject: [PATCH 2/2] Update Readme with resize start/end callbacks. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 71a2600..55bd8af 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,8 @@ rWidth | false | integer or $scope variable | If set, the resizable element will rHeight | false | integer or $scope variable | If set, the resizable element will be rendered with a predefined height relative to this value in pixels and a watcher will be set on the 'rHeight' attribute. [See this codepen](http://codepen.io/Reklino/pen/EjKXqg). rGrabber | `` | string | Defines custom inner html for the grabber. rNoThrottle | false | boolean | Disables `angular-resizable.resizing` throttling (see events section below). +rStart | undefined | function | callback called with `info` when resize starts. (analogous to the `angular-resizable.resizeStart`). +rEnd | undefined | function | callback called with `info` when resize ends. (analogous to the `angular-resizable.resizeEnd`). ## Events