Ionic Tab View - {{Location}} is blank so unable to redirect


I’ve been stuck on this for a day now, any help would be massively helpful! :smile:

So, I created a new app using the tab bar example from ionic. All lovely. I’ve added some new pages/views and got those working too.

I am now trying to setup a redirect on the scope.location however that wasn’t working. I’ve taken a step back and just tried to show {{location}} in any page or view but it appears location isn’t being shown anywhere, it is always blank.

Main files below:

So, my app.js isn’t much different from the default template

// Ionic Starter App

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
// '' is found in services.js
// 'starter.controllers' is found in controllers.js

// here we add our modules first then after that we start up our main app/module of 'starter' in the brackets to the right of that we have to include the modules that we want to load in too

angular.module('AuthApp', []);
angular.module('starter', ['ionic', 'starter.controllers', '', 'AuthApp'])

.run(function($ionicPlatform,$rootScope,$location) {
    $ = $location;
    $ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    if(window.cordova && window.cordova.plugins.Keyboard) {
    if(window.StatusBar) {
      // org.apache.cordova.statusbar required

.config(function($stateProvider, $urlRouterProvider) {

  // Ionic uses AngularUI Router which uses the concept of states
  // Learn more here:
  // Set up the various states which the app can be in.
  // Each state's controller can be found in controllers.js

    // setup an abstract state for the tabs directive
    .state('tab', {
      url: "/tab",
      abstract: true,
      templateUrl: "templates/tabs.html"

    // Each tab has its own nav history stack:

    .state('tab.friends', {
      url: '/friends',
      views: {
        'tab-friends': {
          templateUrl: 'templates/tab-friends.html',
          controller: 'FriendsCtrl'
    .state('tab.friend-detail', {
      url: '/friend/:friendId',
      views: {
        'tab-friends': {
          templateUrl: 'templates/friend-detail.html',
          controller: 'FriendDetailCtrl'
	    .state('', {
      url: '/me',
      views: {
        'tab-me': {
          templateUrl: 'templates/tab-me.html',
          controller: 'meCtrl'

    .state('tab.settings', {
      url: '/settings',
      views: {
        'tab-settings': {
          templateUrl: 'templates/tab-settings.html',
          controller: 'SettingsCtrl'

.state('signup', {
        url: '/signup',
        templateUrl: 'templates/signup.html',
		 controller: 'SignupCtrl'
     .state('login', {
        url: '/login',
        templateUrl: 'templates/login.html',
		 controller: 'LoginCtrl'

    .state('firstview', {
        url: '/firstview',
        templateUrl: 'templates/firstview.html',
		 controller: 'FirstviewCtrl'
  // if none of the above states are matched, use this as the fallback


I’ve tried to make $ = $location; so I can then put {{place}} in my pages and have it show the location, but that isn’t working. If I set it to a string it shows up just fine, which makes me think the app isn’t getting anything for $location.

I don’t know why I am having such a hard time trying to work out this location and redirecting stuff so fingers crossed someone will be able to help get me on track. I’ve managed to work out quite a lot on my own already so this hold up as been frustrating. :smile:

If there is any other information or clarity I can give, please ask :smile:


Take a look at this post, see if it can give you some help