Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add adaptive interpolation symbol #153

Merged
merged 2 commits into from
Feb 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/js/timer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var timerModule = angular.module('timer', [])
autoStart: '&autoStart',
maxTimeUnit: '='
},
controller: ['$scope', '$element', '$attrs', '$timeout', function ($scope, $element, $attrs, $timeout) {
controller: ['$scope', '$element', '$attrs', '$timeout', '$interpolate', function ($scope, $element, $attrs, $timeout, $interpolate) {

// Checking for trim function since IE8 doesn't have it
// If not a function, create tirm with RegEx to mimic native trim
Expand All @@ -28,7 +28,7 @@ var timerModule = angular.module('timer', [])
$scope.autoStart = $attrs.autoStart || $attrs.autostart;

if ($element.html().trim().length === 0) {
$element.append($compile('<span>{{millis}}</span>')($scope));
$element.append($compile('<span>' + $interpolate.startSymbol() + 'millis' + $interpolate.endSymbol() + '</span>')($scope));
} else {
$element.append($compile($element.contents())($scope));
}
Expand Down
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ <h3>

<div class="bs-docs-example">
<p>
Following is the countdown timer setting for the days, hours, minutes & seconds to <b>January 1, 2015 (GMT-6) </b>
<p class="muted">(01 Jan 2015 06:00:00 GMT = 1420070400000 milliseconds)</p>
<code ng-non-bindable="">&lt;timer end-time=&quot;1420070400000&quot;&gt;{{days}} days, {{hours}} hours, {{minutes}} minutes, {{seconds}} seconds.&lt;/timer&gt;</code>
Following is the countdown timer setting for the days, hours, minutes & seconds to <b>January 1, 2016 (GMT-6) </b>
<p class="muted">(01 Jan 2016 06:00:00 GMT = 1451628000000 milliseconds)</p>
<code ng-non-bindable="">&lt;timer end-time=&quot;1451628000000&quot;&gt;{{days}} days, {{hours}} hours, {{minutes}} minutes, {{seconds}} seconds.&lt;/timer&gt;</code>
<h3>
<timer end-time="1420070400000">{{days}} days, {{hours}} hours, {{minutes}} minutes, {{seconds}} seconds.</timer>
<timer end-time="1451628000000">{{days}} days, {{hours}} hours, {{minutes}} minutes, {{seconds}} seconds.</timer>
</h3>
</div>
</section>
Expand Down