Skip to content

Commit 2710d36

Browse files
committed
angular-js example
1 parent c3ef5b5 commit 2710d36

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

angular-js-example.html

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,24 @@
22
<html>
33
<head>
44
<title>Angular Timer Directive - Simple AngularJS Example</title>
5+
56
<script src="angular/angular.min.js"></script>
67
<script src="app/js/timer.js"></script>
78
<script>
89
angular.module('MyApp', ['timer']);
9-
1010
</script>
1111
</head>
12-
<html ng-app="MyApp">
13-
<body>
14-
{{ 1 + 1}}
12+
<body ng-app="MyApp">
13+
<div>
14+
<timer id="timer1"></timer>
15+
</div>
16+
<div>
17+
<timer interval="5000" id="timer2"></timer>
18+
</div>
19+
<div>
20+
<timer id="timer3">
21+
{{minutes}} minutes, {{seconds}} seconds.
22+
</timer>
23+
</div>
1524
</body>
16-
</html>
25+
</html>

app/js/timer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ angular.module('timer', [])
66
scope: {interval: '=interval'},
77
controller: function ($scope, $element) {
88
if ($element.html().trim().length === 0) {
9-
$element.html($compile('<h3>{{timeTaken}}</h3>')($scope));
9+
$element.append($compile('<h3>{{timeTaken}}</h3>')($scope));
1010
}
1111

1212
$scope.startTime = null;

0 commit comments

Comments
 (0)