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 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(); };