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

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -