-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhellotag.html
51 lines (47 loc) · 1.95 KB
/
hellotag.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
<!DOCTYPE html>
<html ng-app="training">
<head>
<title></title>
<meta charset="utf-8">
<link rel="stylesheet" href="bootstrap/css/bootstrap.css"/>
<link rel="stylesheet" href="font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="css/style.css"/>
<script type="text/javascript" src="js/external/jquery.js"></script>
<script type="text/javascript" src="bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="js/external/angular_1.2-rc2.js"></script>
<script type="text/javascript">
angular.module("training", [])
.directive("wjHelloTag", function () {
return {
restrict: 'E',
scope: {name: '@'} ,
template: "<div class='hello-tag'>" +
"Hello<br/> My name is" +
"<div class='inner'>" +
"{{name}}" +
"</div>" +
"</div>",
controller:function($element, $timeout){
var colors =["red", "black", "green"];
var idx = 0;
function switchColor(){
console.log($element);
$timeout(function(){
$element.find(".inner").css("color", colors[idx]);
idx = idx+1;
if (idx > colors.length){
idx = 0;
}
switchColor();
}, 1000);
}
switchColor()
}
}
});
</script>
</head>
<body>
<wj-hello-tag name='abc'></wj-hello-tag>
</body>
</html>