Repository: cordova-app-harness Updated Branches: refs/heads/master ac4a90611 -> 6f961db4e
Fix addApp returning a promise in the middle of the promise chain (hid error messages) Project: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/commit/343b9d0b Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/343b9d0b Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/343b9d0b Branch: refs/heads/master Commit: 343b9d0b4021eba94e6c29b91c67c0b4484200c8 Parents: ac4a906 Author: Andrew Grieve <[email protected]> Authored: Sun Mar 9 22:49:16 2014 -0400 Committer: Andrew Grieve <[email protected]> Committed: Sun Mar 9 22:49:16 2014 -0400 ---------------------------------------------------------------------- www/cdvah/js/AddCtrl.js | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/343b9d0b/www/cdvah/js/AddCtrl.js ---------------------------------------------------------------------- diff --git a/www/cdvah/js/AddCtrl.js b/www/cdvah/js/AddCtrl.js index 1373196..405c9a0 100644 --- a/www/cdvah/js/AddCtrl.js +++ b/www/cdvah/js/AddCtrl.js @@ -29,7 +29,7 @@ }); } else { $scope.appData = { - appUrl : '', + appUrl: '', installerType: 'serve' }; } @@ -53,7 +53,7 @@ }); if (urlChanged) { - p.then(function() { + return p.then(function() { // If the URL changed, trigger an update. return AppsService.updateApp(editingApp); }).then(function() { @@ -65,19 +65,18 @@ notifier.error(msg); }); } - } else { - var serviceCall = AppsService.addApp($scope.appData.installerType, $scope.appData.appUrl); - - serviceCall.then(function(handler) { - console.log('App Added'); - notifier.success('App Added'); - $location.path('/'); - return AppsService.updateApp(handler); - }, function(error) { - console.error(error); - notifier.error('Unable to add application because: ' + error.message); - }); + return p; } + return AppsService.addApp($scope.appData.installerType, $scope.appData.appUrl) + .then(function(handler) { + console.log('App Added'); + notifier.success('App Added'); + $location.path('/'); + return AppsService.updateApp(handler); + }, function(error) { + console.error(error); + notifier.error('Unable to add application because: ' + error.message); + }); }; // True if the optional barcodescanner plugin is installed.
