Skip to content

Commit

Permalink
v1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
siddii committed Feb 25, 2015
1 parent 69838cb commit 423657e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"author": "Siddique Hameed",
"name": "angular-timer",
"version": "1.2.0",
"version": "1.2.1",
"homepage": "https://github.com/siddii/angular-timer",
"description": "Angular-Timer : A simple AngularJS directive demonstrating re-usability & interoperability",
"repository": {
Expand Down
14 changes: 10 additions & 4 deletions dist/angular-timer.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* angular-timer - v1.2.0 - 2014-12-15 6:34 PM
* angular-timer - v1.2.1 - 2015-02-25 4:19 PM
* https://github.com/siddii/angular-timer
*
* Copyright (c) 2014 Siddique Hameed
* Copyright (c) 2015 Siddique Hameed
* Licensed MIT <https://github.com/siddii/angular-timer/blob/master/LICENSE.txt>
*/
var timerModule = angular.module('timer', [])
Expand All @@ -19,7 +19,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 @@ -35,7 +35,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 Expand Up @@ -76,6 +76,12 @@ var timerModule = angular.module('timer', [])
}
}

$scope.$watch('startTimeAttr', function(newValue, oldValue) {
if (newValue !== oldValue && $scope.isRunning) {
$scope.start();
}
});

$scope.start = $element[0].start = function () {
$scope.startTime = $scope.startTimeAttr ? new Date($scope.startTimeAttr) : new Date();
$scope.endTime = $scope.endTimeAttr ? new Date($scope.endTimeAttr) : null;
Expand Down
6 changes: 3 additions & 3 deletions dist/angular-timer.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"author": "Siddique Hameed",
"name": "angular-timer",
"version": "1.2.0",
"version": "1.2.1",
"homepage": "https://github.com/siddii/angular-timer",
"main":"dist/angular-timer.js",
"licenses": {
Expand Down

0 comments on commit 423657e

Please sign in to comment.