App.directive('tFabric', function($rootScope){
return {
restrict: 'A',
replace: true,
template: '<canvas id="{{id}}"></canvas>',
scope: {
id: '@tFabric',
width: '@width',
height: '@height'
},
link: function(scope, element) {
var c = new fabric.Canvas(scope.id);
c.setWidth(scope.width);
c.setHeight(scope.height);
}
};
}); |