Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49167

Load a message depending on login or logout

$
0
0

@PterPmnta wrote:

I'm trying to load a message which depends on whether the user is signing in or out the session, but there must be something wrong because it only shows me the "Loading Information" (both signing in and out). I use the backView() method that obtains the previous view to the current one.

This is my code:

login.js

angular.module(`moduleLogin`)
   .controller(`login_C`, login_C);

function login_C($scope){

$scope.click = function(){

$window.localStorage.logged = true;

$state.go(loading);

  }

}

loading.js

angular.module(`moduleLoading`)
   .controller(`loading_C`, loading_C);

function loading_C($scope){

  if (!$window.localStorage.logged) {
      $scope.mensaje = "Loading Information";
  } else {
      $scope.mensaje = "Closing Session";
  }

}

menu.js

delete $window.localStorage.logged;

If I sign in again (closing session and starting it again) then I get the right message, but not the first time that I log in.This is a small image explaining what I'm trying to do:

Posts: 4

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 49167

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>