@@ -110,9 +110,9 @@ <h3><timer id="timer3">{{minutes}} minutes, {{seconds}} seconds.</timer></h3>
110
110
< button type ="button " class ="btn " onclick ="stopTimer('timer3', this) "> Stop</ button >
111
111
</ div >
112
112
</ section >
113
- < h2 > Examples</ h2 >
113
+ < h3 > Examples</ h3 >
114
114
< section id ="angularjs-example ">
115
- < h3 > Using timer directive from Angular</ h3 >
115
+ < h4 > Using timer directive from Angular</ h4 >
116
116
< ul class ="nav nav-tabs " id ="myTab ">
117
117
< li class ="active "> < a data-toggle ="tab " href ="#angularjs-example-source "> index.html</ a > </ li >
118
118
< li > < a data-toggle ="tab " href ="#angularjs-example-demo "> Demo</ a > </ li >
@@ -121,13 +121,50 @@ <h3>Using timer directive from Angular</h3>
121
121
< div class ="tab-content ">
122
122
< div class ="tab-pane active " id ="angularjs-example-source ">
123
123
< pre class ="prettyprint linenums ">
124
- < code >
125
- <a data-toggle="modal" href="remote.html" data-target="#modal">click me</a>
126
- </ code >
127
- </ pre >
124
+ <!DOCTYPE html>
125
+ <html>
126
+ <head>
127
+ <title>Timer Directive used from AngularJS</title>
128
+ <script src="angular/angular.min.js"></script>
129
+ <script src="app/js/timer.js"></script>
130
+ <script>
131
+ angular.module('MyApp', ['timer']);
132
+ function MyAppController($scope) {
133
+ $scope.timerRunning = true;
134
+
135
+ $scope.startTimer = function (){
136
+ $scope.$broadcast('timer-start');
137
+ $scope.timerRunning = true;
138
+ };
139
+
140
+ $scope.stopTimer = function (){
141
+ $scope.$broadcast('timer-stop');
142
+ $scope.timerRunning = false;
143
+ };
144
+ }
145
+ MyAppController.$inject = ['$scope'];
146
+ </script>
147
+ </head>
148
+ <body ng-app="MyApp">
149
+ <div ng-controller="MyAppController" style="border: 1px solid gainsboro; text-align: center;">
150
+ <h2>Single Timer</h2>
151
+ <h3><timer/></h3>
152
+ <button ng-click="startTimer()" ng-disabled="timerRunning">Start Timer</button>
153
+ <button ng-click="stopTimer()" ng-disabled="!timerRunning">Stop Timer</button>
154
+ </div>
155
+ <br/>
156
+ <div ng-controller="MyAppController" style="border: 1px solid gainsboro; text-align: center;">
157
+ <h2>Multiple Timers</h2>
158
+ <h3>Timer 1: <timer interval="2000"/></h3>
159
+ <h3>Timer 2: <timer>{{minutes}} minutes, {{seconds}} seconds.</timer></h3>
160
+ <button ng-click="startTimer()" ng-disabled="timerRunning">Start Timers</button>
161
+ <button ng-click="stopTimer()" ng-disabled="!timerRunning">Stop Timers</button>
162
+ </div>
163
+ </body>
164
+ </html></ pre >
128
165
</ div >
129
166
< div class ="tab-pane " id ="angularjs-example-demo ">
130
- < h1 > Demo </ h1 >
167
+ < iframe src =" examples/angular-js-example.html " width =" 100% " height =" 350px " > </ iframe >
131
168
</ div >
132
169
</ div >
133
170
</ section >
0 commit comments