App structure and routing

Hey @davidgeilfus, welcome to Ionic :smile:

For #1, what I recommend is a service that manages login states, something like this:

angular.module('myapp', [])

.factory('User', function($rootScope, $location) {
  var isLoggedIn = false;

  // Load auth token from somewhere, like localStorage
  isLoggedIn = window.localStorage['token'] != nulll 


  $rootScope.$on('user.logout', function() {
    isLoggedIn = false;

    // redir to login page
    $location.path('/');
  });

  return {
    isLoggedIn: function() { return isLoggedIn; }
    login: function(username, password) {
      // Do login here
      // If login worked, trigger event
      $rootScope.$broadcast('user.login');
    },
    logout: function() {
      $rootScope.$broadcast('user.logout');
    }
  }
});

You can also listen for those events in your other controllers and such.

  1. In terms of not using the animation in this case, right now the answer is no without manually removing the classname from the nav-router div, but we are overhauling the nav stuff so that should work in the future.

  2. To hide the nav bar on just that page, use <nav-page hide-nav-bar="true"></nav-page>

  3. In terms of activating that specific tab, that’s a little more tricky and we are working to make this more clear. For now, perhaps this topic will help: Switch tab in controller

5 Likes