I am trying to make a resizable dialog, like this: DEMO.
.directive("dialog", function() {
return {
restrict: 'E',
replace: true,
scope: {},
templateUrl: 'dialog-template.html',
controller: function($scope, $element) {
$scope.movabled = true;
$scope.dialogElem = $element;
},
link: function(scope, iElem, iAttrs) {
/* ...... */
scope.$watch(function() {
var width = scope.dialogElem.outerWidth(),
height = scope.dialogElem.outerHeight();
return [width, height];
}, function(nValue) {
console.log(nValue);
var width = nValue[0], height = nValue[1],
content = scope.dialogElem.find('.content');
content.css('height', height-84);
content.find('.left-panel')
.css('width', width-110)
.css('height', height-84);
content.find('.right-panel')
.css('height', height-84);
}, true);
}
};
})
But angularjs watch event did not trigger when I expand dialog.
So, how can I $watch transition-property with angularjs?
default
$watchto watch the DOM because Angular will execute your callback at every digest cycle and DOM access is very slow compared to memory access.