-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstep4.html
54 lines (50 loc) · 1.68 KB
/
step4.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Angular SVG demo</title>
<link rel="stylesheet" href="demo.css">
</head>
<body ng-app="myApp">
<div ng-controller="SvgCtrl">
<h1>{{greeting}}</h1>
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
id="mysvg">
<text x="200" y="100" class="textStyle">{{svgText}}</text>
<circle ng-repeat="circle in circles" ng-attr-cx="{{circle.cx}}" ng-attr-cy="{{circle.cy}}" ng-attr-r="{{circle.r}}" ng-attr-fill="{{circle.color}}" />
</svg>
<div class="controls">
<h2>Text</h2>
<input type="text" ng-model="svgText">
<div ng-repeat="circle in circles">
<h2>Circle {{$index + 1}}</h2>
<label for="cx">X</label>
<input id="cx" type="number" ng-model="circle.cx" /><br>
<label for="cy">Y</label>
<input id="cy" type="number" ng-model="circle.cy" /><br>
<label for="r">Radius</label>
<input id="r" type="number" ng-model="circle.r" /><br>
<label for="color">Color</label>
<input id="color" type="text" ng-model="circle.color" />
</div>
</div>
</div>
<script type="text/javascript" src="http://code.angularjs.org/1.2.0rc1/angular.min.js"></script>
<script type="text/javascript">
var myApp = angular.module('myApp',[]);
function SvgCtrl($scope) {
$scope.greeting = 'Now let\'s add an svg here.';
$scope.svgText = 'Hello';
$scope.circles = [
{cx: 400,cy: 200,r: 100,color: 'red'},
{cx: 200,cy: 400,r: 50,color: 'green'},
{cx: 300,cy: 300,r: 70,color: 'blue'},
{cx: 600,cy: 600,r: 150,color: 'lime'}
];
}
</script>
</body>
</html>