diff --git a/angular-resizable.min.js b/angular-resizable.min.js
index eb0f450..238deda 100644
--- a/angular-resizable.min.js
+++ b/angular-resizable.min.js
@@ -1 +1 @@
-angular.module("angularResizable",[]).directive("resizable",function(){function e(e){void 0===t?(t=e,setTimeout(function(){t(),t=void 0},100)):t=e}var t;return{restrict:"AE",scope:{rDirections:"=",rCenteredX:"=",rCenteredY:"=",rWidth:"=",rHeight:"=",rFlex:"=",rGrabber:"@",rDisabled:"@"},link:function(t,n,r){var i="flexBasis"in document.documentElement.style?"flexBasis":"webkitFlexBasis"in document.documentElement.style?"webkitFlexBasis":"msFlexPreferredSize"in document.documentElement.style?"msFlexPreferredSize":"flexBasis";t.$watch("rWidth",function(e){n[0].style[t.rFlex?i:"width"]=t.rWidth+"px"}),t.$watch("rHeight",function(e){n[0].style[t.rFlex?i:"height"]=t.rHeight+"px"}),n.addClass("resizable");var s,o,a,u,l,d=window.getComputedStyle(n[0],null),c=t.rDirections,h=t.rCenteredX?2:1,m=t.rCenteredY?2:1,v=t.rGrabber?t.rGrabber:"",p={},f=function(e){p.width=!1,p.height=!1,"x"===l?p.width=parseInt(n[0].style[t.rFlex?i:"width"]):p.height=parseInt(n[0].style[t.rFlex?i:"height"]),p.id=n[0].id,p.evt=e},x=function(e){return e.touches?e.touches[0].clientX:e.clientX},g=function(e){return e.touches?e.touches[0].clientY:e.clientY},b=function(r){var d,c="x"===l?a-x(r):a-g(r);switch(u){case"top":d=t.rFlex?i:"height",n[0].style[d]=o+c*m+"px";break;case"bottom":d=t.rFlex?i:"height",n[0].style[d]=o-c*m+"px";break;case"right":d=t.rFlex?i:"width",n[0].style[d]=s-c*h+"px";break;case"left":d=t.rFlex?i:"width",n[0].style[d]=s+c*h+"px"}f(r),e(function(){t.$emit("angular-resizable.resizing",p)})},y=function(e){f(),t.$emit("angular-resizable.resizeEnd",p),t.$apply(),document.removeEventListener("mouseup",y,!1),document.removeEventListener("mousemove",b,!1),document.removeEventListener("touchend",y,!1),document.removeEventListener("touchmove",b,!1),n.removeClass("no-transition")},E=function(e,r){u=r,l="left"===u||"right"===u?"x":"y",a="x"===l?x(e):g(e),s=parseInt(d.getPropertyValue("width")),o=parseInt(d.getPropertyValue("height")),n.addClass("no-transition"),document.addEventListener("mouseup",y,!1),document.addEventListener("mousemove",b,!1),document.addEventListener("touchend",y,!1),document.addEventListener("touchmove",b,!1),e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),e.cancelBubble=!0,e.returnValue=!1,f(e),t.$emit("angular-resizable.resizeStart",p),t.$apply()};c.forEach(function(e){var r=document.createElement("div");r.setAttribute("class","rg-"+e),r.innerHTML=v,n[0].appendChild(r),r.ondragstart=function(){return!1};var i=function(n){var r="true"===t.rDisabled;r||1!==n.which&&!n.touches||E(n,e)};r.addEventListener("mousedown",i,!1),r.addEventListener("touchstart",i,!1)})}}});
\ No newline at end of file
+angular.module("angularResizable",[]).directive("resizable",["$compile","$rootScope",function(e,t){function r(e){void 0===n?(n=e,setTimeout(function(){n(),n=void 0},100)):n=e}var n;return{restrict:"AE",scope:{rDirections:"=",rCenteredX:"=",rCenteredY:"=",rWidth:"=",rHeight:"=",rFlex:"=",rGrabber:"@",rDisabled:"@",rNoThrottle:"="},link:function(t,n,i){var o="flexBasis"in document.documentElement.style?"flexBasis":"webkitFlexBasis"in document.documentElement.style?"webkitFlexBasis":"msFlexPreferredSize"in document.documentElement.style?"msFlexPreferredSize":"flexBasis";t.$watch("rWidth",function(e){n[0].style[t.rFlex?o:"width"]=t.rWidth+"px"}),t.$watch("rHeight",function(e){n[0].style[t.rFlex?o:"height"]=t.rHeight+"px"}),n.addClass("resizable");var a,s,l,u,d,c=function(r){var n=e(angular.element(r));return n(t.$parent)[0]},h=window.getComputedStyle(n[0],null),m=t.rDirections||["right"],p=t.rCenteredX?2:1,v=t.rCenteredY?2:1,f=c(t.rGrabber?t.rGrabber:""),g={},x=function(e){g.width=!1,g.height=!1,"x"===d?g.width=parseInt(n[0].style[t.rFlex?o:"width"]):g.height=parseInt(n[0].style[t.rFlex?o:"height"]),g.id=n[0].id,g.evt=e},b=function(e){return e.touches?e.touches[0].clientX:e.clientX},y=function(e){return e.touches?e.touches[0].clientY:e.clientY},E=function(e){function i(){t.$emit("angular-resizable.resizing",g)}var c,h="x"===d?l-b(e):l-y(e);switch(u){case"top":c=t.rFlex?o:"height",n[0].style[c]=s+h*v+"px";break;case"bottom":c=t.rFlex?o:"height",n[0].style[c]=s-h*v+"px";break;case"right":c=t.rFlex?o:"width",n[0].style[c]=a-h*p+"px";break;case"left":c=t.rFlex?o:"width",n[0].style[c]=a+h*p+"px"}x(e),t.rNoThrottle?i():r(i)},w=function(e){x(),t.$emit("angular-resizable.resizeEnd",g),t.$apply(),document.removeEventListener("mouseup",w,!1),document.removeEventListener("mousemove",E,!1),document.removeEventListener("touchend",w,!1),document.removeEventListener("touchmove",E,!1),n.removeClass("no-transition")},F=function(e,r){u=r,d="left"===u||"right"===u?"x":"y",l="x"===d?b(e):y(e),a=parseInt(h.getPropertyValue("width")),s=parseInt(h.getPropertyValue("height")),n.addClass("no-transition"),document.addEventListener("mouseup",w,!1),document.addEventListener("mousemove",E,!1),document.addEventListener("touchend",w,!1),document.addEventListener("touchmove",E,!1),e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),e.cancelBubble=!0,e.returnValue=!1,x(e),t.$emit("angular-resizable.resizeStart",g),t.$apply()};m.forEach(function(e){var r=document.createElement("div");r.setAttribute("class","rg-"+e),r.appendChild(f),n[0].appendChild(r),r.ondragstart=function(){return!1};var i=function(r){var n="true"===t.rDisabled;n||1!==r.which&&!r.touches||F(r,e)};r.addEventListener("mousedown",i,!1),r.addEventListener("touchstart",i,!1)})}}}]);
\ No newline at end of file
diff --git a/src/angular-resizable.js b/src/angular-resizable.js
index 22866f2..78b05e7 100644
--- a/src/angular-resizable.js
+++ b/src/angular-resizable.js
@@ -1,5 +1,5 @@
angular.module('angularResizable', [])
- .directive('resizable', function() {
+ .directive('resizable', ['$compile', '$rootScope', function($compile, $rootScope) {
var toCall;
function throttle(fun) {
if (toCall === undefined) {
@@ -40,13 +40,19 @@ angular.module('angularResizable', [])
element.addClass('resizable');
+ var getCompiledGrabber = function(grabber)
+ {
+ var linkFunction = $compile(angular.element(grabber));
+ return linkFunction(scope.$parent)[0];
+ };
+
var style = window.getComputedStyle(element[0], null),
w,
h,
dir = scope.rDirections || ['right'],
vx = scope.rCenteredX ? 2 : 1, // if centered double velocity
vy = scope.rCenteredY ? 2 : 1, // if centered double velocity
- inner = scope.rGrabber ? scope.rGrabber : '',
+ inner = getCompiledGrabber(scope.rGrabber ? scope.rGrabber : ''),
start,
dragDir,
axis,
@@ -141,7 +147,7 @@ angular.module('angularResizable', [])
// add class for styling purposes
grabber.setAttribute('class', 'rg-' + direction);
- grabber.innerHTML = inner;
+ grabber.appendChild(inner);
element[0].appendChild(grabber);
grabber.ondragstart = function() { return false; };
@@ -157,4 +163,4 @@ angular.module('angularResizable', [])
});
}
};
- });
+ }]);