Tried to fix the counting for zero,

but the real problem relies in that the device counting takes time and
we don't know before-hand how many devices we have.
Also the scope is not shared between the device list and the remote control.
This commit is contained in:
Gunther Brunner
2014-07-16 17:50:20 +09:00
parent 0057bca523
commit dd5b04998d
3 changed files with 8 additions and 7 deletions

View File

@@ -13,7 +13,7 @@ module.exports = function counterDirective($timeout, $$rAF) {
step = 0
scope.timoutId = null
countTo = parseInt(attrs.countTo) || 0
scope.value = parseInt(attrs.value, 10) || 0
scope.value = parseInt(attrs.countFrom, 10) || 0
duration = parseFloat(attrs.duration) || 0
steps = Math.ceil(duration / refreshInterval)
@@ -52,7 +52,7 @@ module.exports = function counterDirective($timeout, $$rAF) {
}
})
attrs.$observe('value', function (val) {
attrs.$observe('countFrom', function (val) {
start()
})

View File

@@ -1,4 +1,4 @@
module.exports = angular.module('stf.counter', [
])
.directive('counter', require('./counter-directive'))
.directive('countFrom', require('./counter-directive'))