Add reason of why device and control are undefined sometimes.

This commit is contained in:
Gunther Brunner
2014-09-02 18:20:27 +09:00
parent ce604d8211
commit fe7452e9f7
4 changed files with 13 additions and 8 deletions

View File

@@ -156,6 +156,10 @@ module.exports =
})
}
// TODO: Move this out to Ctrl.resolve
// http://blog.brunoscopelliti.com/show-route-only-after-all-promises-are-resolved
// http://odetocode.com/blogs/scott/archive/2014/05/20/using-resolve-in-angularjs-routes.aspx
DeviceService.get($routeParams.serial, $scope)
.then(function (device) {
return GroupService.invite(device)
@@ -164,8 +168,6 @@ module.exports =
$scope.device = device
$scope.control = ControlService.create(device, device.channel)
//FatalMessageService.open($scope.device)
return device
})
.catch(function () {
@@ -174,10 +176,6 @@ module.exports =
})
})
// TODO: WHAT???
//$scope.$watch('device')
$scope.$watch('device.state', function (newValue, oldValue) {
if (newValue !== oldValue) {
if (oldValue === 'using') {