Angularjs directive that resizes only width of the canvas -
how can write directive changes width of canvas?
actually going pretty simple. below simple directive resize element's width.
var ag = angular.module('ag', []); var resizex = function() { return { restrict: 'a', scope: { resizex: '=' }, link: function postlink(scope, element, attrs) { scope.$watch('resizex', function(value) { element.css('width', value + 'px'); }); } }; }; ag.directive('resizex', resizex);
just link resizex directive scope model in element.
here working example: http://plnkr.co/edit/avsautazqqybb5vczgob?p=preview
let me know if works you.
Comments
Post a Comment