File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change 2
2
< html >
3
3
< head >
4
4
< title > Angular Timer Directive - Simple AngularJS Example</ title >
5
+
5
6
< script src ="angular/angular.min.js "> </ script >
6
7
< script src ="app/js/timer.js "> </ script >
7
8
< script >
8
9
angular . module ( 'MyApp' , [ 'timer' ] ) ;
9
-
10
10
</ script >
11
11
</ 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 >
15
24
</ body >
16
- </ html >
25
+ </ html >
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ angular.module('timer', [])
6
6
scope : { interval : '=interval' } ,
7
7
controller : function ( $scope , $element ) {
8
8
if ( $element . html ( ) . trim ( ) . length === 0 ) {
9
- $element . html ( $compile ( '<h3>{{timeTaken}}</h3>' ) ( $scope ) ) ;
9
+ $element . append ( $compile ( '<h3>{{timeTaken}}</h3>' ) ( $scope ) ) ;
10
10
}
11
11
12
12
$scope . startTime = null ;
You can’t perform that action at this time.
0 commit comments