Skip to content

Commit 5831cba

Browse files
committed
Changing auto-start attribute to 'autostart'
See siddii#14
1 parent eca78d5 commit 5831cba

4 files changed

Lines changed: 22 additions & 11 deletions

File tree

‎app/js/timer.js‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,14 @@ angular.module('timer', [])
77
interval: '=interval',
88
startTimeAttr: '=startTime',
99
countdownattr: '=countdown',
10-
autoStart: '=autoStart'
10+
autoStart: '&autoStart'
1111
},
12-
controller: ['$scope', '$element', function ($scope, $element) {
12+
controller: ['$scope', '$element', '$attrs', function ($scope, $element, $attrs) {
13+
//angular 1.2 doesn't support attributes ending in "-start", so we're
14+
//supporting both "autostart" and "auto-start" as a solution for
15+
//backward and forward compatibility.
16+
$scope.autoStart = $attrs.autoStart || $attrs.autostart;
17+
1318
if ($element.html().trim().length === 0) {
1419
$element.append($compile('<span>{{millis}}</span>')($scope));
1520
}

‎dist/angular-timer.js‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* angular-timer - v1.0.3 - 2013-09-25 7:08 PM
2+
* angular-timer - v1.0.3 - 2013-09-26 8:49 AM
33
* https://github.com/siddii/angular-timer
44
*
55
* Copyright (c) 2013 Siddique Hameed
@@ -14,9 +14,14 @@ angular.module('timer', [])
1414
interval: '=interval',
1515
startTimeAttr: '=startTime',
1616
countdownattr: '=countdown',
17-
autoStart: '=autoStart'
17+
autoStart: '&autoStart'
1818
},
19-
controller: ['$scope', '$element', function ($scope, $element) {
19+
controller: ['$scope', '$element', '$attrs', function ($scope, $element, $attrs) {
20+
//angular 1.2 doesn't support attributes ending in "-start", so we're
21+
//supporting both "autostart" and "auto-start" as a solution for
22+
//backward and forward compatibility.
23+
$scope.autoStart = $attrs.autoStart || $attrs.autostart;
24+
2025
if ($element.html().trim().length === 0) {
2126
$element.append($compile('<span>{{millis}}</span>')($scope));
2227
}

‎dist/angular-timer.min.js‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎index.html‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,13 @@ <h3>
120120
</section>
121121
<section id="auto-start-false-timer">
122122
<h3>
123-
Timer with <em>auto-start = false</em></h3>
123+
Timer with <em>autostart = false</em></h3>
124124

125125
<div class="bs-docs-example">
126126
<p>
127-
Click on the start button to start the timer. <code ng-non-bindable="">&lt;timer auto-start="false" interval="1000"&gt;{{seconds}}&lt;/timer&gt;</code></p>
127+
Click on the start button to start the timer. <code ng-non-bindable="">&lt;timer autostart="false" interval="1000"&gt;{{seconds}}&lt;/timer&gt;</code></p>
128128
<h3>
129-
<timer auto-start="false" interval="1000">{{seconds}}</timer>
129+
<timer autostart="false" interval="1000">{{seconds}}</timer>
130130
</h3>
131131
<button class="btn" onclick="stopResumeTimer('auto-start-false-timer', this)" type="button">Start</button>
132132
</div>
@@ -178,7 +178,8 @@ <h4>
178178
</tr>
179179
<tr>
180180
<td>
181-
auto-start
181+
autostart<br/>
182+
<em>Formerly called 'auto-start'. Please see this <a target="_new" href="https://github.com/siddii/angular-timer/issues/14">issue</a></em>
182183
</td>
183184
<td>
184185
false

0 commit comments

Comments
 (0)