File tree Expand file tree Collapse file tree 4 files changed +90
-6
lines changed Expand file tree Collapse file tree 4 files changed +90
-6
lines changed Original file line number Diff line number Diff line change 2
2
< html >
3
3
< head >
4
4
< title > AngularJS Example - Multiple Timers</ title >
5
+ < style type ="text/css ">
6
+ div {
7
+ border : 1px solid gainsboro;
8
+ text-align : center;
9
+ margin : 15px ;
10
+ padding : 15px ;
11
+ }
12
+ </ style >
5
13
< script src ="../angular/angular.min.js "> </ script >
6
14
< script src ="../app/js/timer.js "> </ script >
7
15
< script >
8
16
angular . module ( 'MyApp' , [ 'timer' ] ) ;
17
+
9
18
function MyAppController ( $scope ) {
10
19
$scope . timerRunning = true ;
11
20
24
33
</ head >
25
34
< body ng-app ="MyApp ">
26
35
< div ng-controller ="MyAppController " style ="border: 1px solid gainsboro; text-align: center; ">
27
- < h2 > Multiple Timers</ h2 >
36
+ < h2 > AngularJS - Multiple Timers Example </ h2 >
28
37
< h3 > Timer 1: < timer /> </ h3 >
29
38
< h3 > Timer 2: < timer interval ="2000 "/> </ h3 >
30
39
< h3 > Timer 3: < timer > {{minutes}} minutes, {{seconds}} seconds.</ timer > </ h3 >
Original file line number Diff line number Diff line change 2
2
< html >
3
3
< head >
4
4
< title > AngularJS Example - Single Timer</ title >
5
+ < style type ="text/css ">
6
+ div {
7
+ border : 1px solid gainsboro;
8
+ text-align : center;
9
+ margin : 15px ;
10
+ padding : 15px ;
11
+ }
12
+ </ style >
5
13
< script src ="../angular/angular.min.js "> </ script >
6
14
< script src ="../app/js/timer.js "> </ script >
7
15
< script >
8
- var myApp = angular . module ( 'MyApp' , [ 'timer' ] ) ;
16
+ angular . module ( 'MyApp' , [ 'timer' ] ) ;
9
17
10
18
function MyAppController ( $scope ) {
11
- var timerDirective = myApp . directive ( 'timer' ) ;
12
- console . log ( '###### Timer Directive = ' , timerDirective ) ;
13
19
$scope . timerRunning = true ;
14
20
15
21
$scope . startTimer = function ( ) {
26
32
</ script >
27
33
</ head >
28
34
< body ng-app ="MyApp ">
29
- < div ng-controller ="MyAppController " style =" border: 1px solid gainsboro; text-align: center; " >
30
- < h2 > Single Timer</ h2 >
35
+ < div ng-controller ="MyAppController ">
36
+ < h2 > AngularJS - Single Timer Example </ h2 >
31
37
< h3 > < timer /> </ h3 >
32
38
< button ng-click ="startTimer() " ng-disabled ="timerRunning "> Start Timer</ button >
33
39
< button ng-click ="stopTimer() " ng-disabled ="!timerRunning "> Stop Timer</ button >
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html >
3
+ < head >
4
+ < title > AngularJS Example - Single Timer</ title >
5
+ < style type ="text/css ">
6
+ div {
7
+ border : 1px solid gainsboro;
8
+ text-align : center;
9
+ margin : 15px ;
10
+ padding : 15px ;
11
+ }
12
+ </ style >
13
+ < script src ="../jquery/jquery-1.9.1.min.js "> </ script >
14
+ < script src ="../angular/angular.min.js "> </ script >
15
+ < script src ="../app/js/timer.js "> </ script >
16
+ < script >
17
+ function startTimer ( ) {
18
+ $ ( 'timer' ) [ 0 ] . start ( ) ;
19
+ }
20
+
21
+ function stopTimer ( ) {
22
+ $ ( 'timer' ) [ 0 ] . stop ( ) ;
23
+ }
24
+ </ script >
25
+ </ head >
26
+ < body >
27
+ < div ng-controller ="MyAppController ">
28
+ < h2 > JQuery - Timer Example</ h2 >
29
+ < h3 ng-app ="timer "> < timer /> </ h3 >
30
+ < button onclick ="startTimer() "> Start Timer</ button >
31
+ < button onclick ="stopTimer() "> Stop Timer</ button >
32
+ </ div >
33
+ < br />
34
+ </ body >
35
+ </ html >
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html >
3
+ < head >
4
+ < title > AngularJS Example - Single Timer</ title >
5
+ < style type ="text/css ">
6
+ div {
7
+ border : 1px solid gainsboro;
8
+ text-align : center;
9
+ margin : 15px ;
10
+ padding : 15px ;
11
+ }
12
+ </ style >
13
+ < script src ="../angular/angular.min.js "> </ script >
14
+ < script src ="../app/js/timer.js "> </ script >
15
+ < script >
16
+ function startTimer ( ) {
17
+ document . getElementsByTagName ( 'timer' ) [ 0 ] . start ( ) ;
18
+ }
19
+
20
+ function stopTimer ( ) {
21
+ document . getElementsByTagName ( 'timer' ) [ 0 ] . stop ( ) ;
22
+ }
23
+ </ script >
24
+ </ head >
25
+ < body >
26
+ < div ng-controller ="MyAppController ">
27
+ < h2 > Plain JavaScript - Timer Example</ h2 >
28
+ < h3 ng-app ="timer "> < timer /> </ h3 >
29
+ < button onclick ="startTimer() "> Start Timer</ button >
30
+ < button onclick ="stopTimer() "> Stop Timer</ button >
31
+ </ div >
32
+ < br />
33
+ </ body >
34
+ </ html >
You can’t perform that action at this time.
0 commit comments