@Pajimola wrote:
.controller('LoginCtrl', function($scope, $state, $rootScope, $cordovaDialogs, LoginService){
$scope.form = {};
$scope.submit = function(){
// TODO: Add some native loading if((angular.isDefined($scope.form.username) && $scope.form.username !== "") && angular.isDefined($scope.form.password) && $scope.form.password !== ""){ LoginService.login($scope.form).then(function(response){ var str = response.data; str.replace(/\s/g, ''); if(str === "1") { $cordovaDialogs.alert('Login success!', 'Login', 'Ok').then(function() { // callback success }); if(Storage){ localStorage.setItem('loginDetails', JSON.stringify($scope.form)); } else { $cordovaDialogs.alert('Storage is not defined in this browser. Please use other storage.', 'Login', 'Ok').then(function() { // callback success }); } } }, function(error){ }); $state.go('tab.chats'); } else { // TODO: Add native message box }
}
});
Posts: 1
Participants: 1