AngularJS. Compiling is not enough transformation in a template if using SVG elements -
i can use user elements.
<div ng-controller="notescretchctrl"><my-element></my-element></div>
angularjs 1.5.8 code there:
angular.module('myapp') .controller('notescretchctrl', function($scope) { $scope.linearray = [10,30,40]; }) .directive('myelement', function ($compile) { return { restrict: 'ea', replace: true, transclude: true, template: '<div class="boxactive"><img width="300"><div class="boxabsolutesvg">'+ '<svg width="600" height="100" class="svg" >'+ '<line ng-repeat="ngy1 in linearray" x1="0" ng-attr-y1="{{ngy1}}" x2="800" y2="20" style="stroke: black; stroke-width: 3;" />'+ '</svg></div></div>' } });
but in "line svg" elements coming out html-code compiling:
<line ng-repeat="linear in linearray" x1="0" ng-attr-y1="{{linear}}" x2="800" y2="20" style="stroke: black; stroke-width: 3;" class="ng-scope" y1="10"></line>
why compilation successful: created attribute y1 = "10"
but not disappeared attributes: ng-attr-y1 = "", {{linear}}, ng-repeat = "linear in linearray" , added closed elements '/line'
you can me sample code?
Comments
Post a Comment