当我点击按钮时,我需要更改svg rect颜色。我成功加载svg,但我有更改颜色rect svg的问题:
Controller.js:
angular.module('svgApp', [])
.controller('MainCtrl', ['$scope', function ($scope) {
$scope.changeColor = function () {
var places = element[0].querySelectorAll('.st2');
$scope.places = "#fffd";
}
}]);
widget.html:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="utf-8" />
<link rel="stylesheet" href="FrontEnd/Css/Style.css"/>
</head>
<body ng-app="svgApp" ng-controller="MainCtrl">
<h1> Hello My WidgetTest</h1>
<div class="container">
<div svg-demo></div>
</div>
<p>
<button ng-click="changeColor()" class="btn btn-block btn-default">ChangeColor</button>
</p>
<script src="Scripts/angular.js"></script>
<script src="FrontEnd/JS/Controller.js"></script>
<script src="FrontEnd/JS/Directive.js"> </script>
<script src="Scripts/jquery-1.9.1.min.js"></script>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="Scripts/bootstrap.js"></script>
</body>