JSFiddle - React, Tailwind, and code Playground
by evictor
HTML
<div ng-app="SampleApp" ng-controller="MainCtrl">
<svg>
<g id="g_{{$index}}" ng-repeat="i in range" ng-cloak>
<rect ng-x="{{i / 5}}" ng-y="{{i / 5}}" ng-width="{{i / 5}}" ng-height="{{i / 5}}"></rect>
</g>
</svg>
</div>
JavaScript
angular.module('SampleApp', [], function() {})
.directive('ngX', function() {
return function(scope, elem, attrs) {
attrs.$observe('ngX', function(x) {
elem.attr('x', x);
});
};
})
.directive('ngY', function() {
return function(scope, elem, attrs) {
attrs.$observe('ngY', function(y) {
elem.attr('y', y);
});
};
})
.directive('ngWidth', function() {
return function(scope, elem, attrs) {
attrs.$observe('ngWidth', function(width) {
elem.attr('width', width);
});
};
})
.directive('ngHeight', function() {
return function(scope, elem, attrs) {
attrs.$observe('ngHeight', function(height) {
elem.attr('height', height);
});
};
});
function MainCtrl($scope) {
$scope.range = [100, 200, 300];
}