From 403bd587abc92395f9245c2de1adf72197179167 Mon Sep 17 00:00:00 2001 From: Arjun Roychowdhury Date: Mon, 26 Oct 2015 16:24:16 -0400 Subject: normalized how save works - except no auto save for login --- www/js/LoginCtrl.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'www/js/LoginCtrl.js') diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js index a0112969..388ee33a 100644 --- a/www/js/LoginCtrl.js +++ b/www/js/LoginCtrl.js @@ -31,9 +31,21 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r $scope.check.isUseEventServer = ($scope.loginData.isUseEventServer == '1') ? true : false; + + //---------------------------------------------------------------- + // Save anyway when you exit + //---------------------------------------------------------------- + + $scope.$on('$ionicView.beforeLeave', function () { + // Don't do this -- it will try to login to ZM + // and go back to the menu + //saveItems(); + }); + + //------------------------------------------------------------------------- // Lets make sure we set screen dim properly as we enter // The problem is we enter other states before we leave previous states @@ -134,8 +146,10 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r //----------------------------------------------------------------------------- // Perform the login action when the user submits the login form //----------------------------------------------------------------------------- - $scope.save = function () { - console.log('Saving login'); + + function saveItems() + { + console.log('Saving login'); /*if (parseInt($scope.loginData.maxMontage) > zm.safeMontageLimit) { $ionicPopup.alert({ @@ -270,6 +284,10 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r }); + } + + $scope.saveItems = function () { + saveItems(); }; -- cgit v1.2.3