1
votes

I have an ion-nav-bar that is hid during login/signin process. After signing in I have tabs on the bottom with the nav bar at the top. The ion-nav-bar can be seen but the title isn't showing anything. What am I doing wrong? Any help would be appreciated.

index.html

<body ng-app="mychat">
<!--
The nav bar that will be updated as we navigate between views.
-->
<ion-nav-bar class="bar-header bar-assertive">
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<!--
The views will be rendered in the <ion-nav-view> directive below
Templates are in the /templates folder (but you could also
have templates inline in this html file if you'd like).
-->
<ion-nav-view></ion-nav-view>
</body>

app.js

.config(function($stateProvider, $urlRouterProvider) { 
console.log("setting config"); 
 // Ionic uses AngularUI Router which uses the concept of states 
 // Learn more here: https://github.com/angular-ui/ui-router 
 // Set up the various states which the app can be in. 
 // Each state's controller can be found in controllers.js 
 $stateProvider 


 // State to represent Login View 
 .state('login', { 
 url: "/login", 
 templateUrl: "templates/login.html", 
 controller: 'LoginCtrl', 
 resolve: { 
     // controller will not be loaded until $waitForAuth resolves 
     // Auth refers to our $firebaseAuth wrapper in the example above 
     "currentAuth": ["Auth", 
         function (Auth) { 
             // $waitForAuth returns a promise so the resolve waits for it to complete 
             return Auth.$waitForAuth(); 
 }] 
 } 
 }) 




  // setup an abstract state for the tabs directive 
 .state('tab', { 
 url: "/tab", 
 abstract: true, 
 templateUrl: "templates/tabs.html", 
 resolve: { 
     // controller will not be loaded until $requireAuth resolves 
     // Auth refers to our $firebaseAuth wrapper in the example above 
     "currentAuth": ["Auth", 
         function (Auth) { 
             // $requireAuth returns a promise so the resolve waits for it to complete 
             // If the promise is rejected, it will throw a $stateChangeError (see above) 
             return Auth.$requireAuth(); 
 }] 
 } 
 }) 


// Each tab has its own nav history stack: 


 .state('tab.home', { 
 url: '/home', 
 views: { 
     'tab-home': { 
         templateUrl: 'templates/tab-home.html', 
         controller: 'HomeCtrl' 
     } 
  } 
 }) 

 .state('tab.movies', { 
 url: '/movies', 
 views: { 
     'tab-movies': { 
         templateUrl: 'templates/tab-movies.html', 
         controller: 'MoviesCtrl' 
     } 
 } 
 }) 

 .state('tab.people', { 
 url: '/people', 
 views: { 
     'tab-people': { 
         templateUrl: 'templates/tab-people.html', 
         controller: 'PeopleCtrl' 
     } 
 } 
 }) 




 // if none of the above states are matched, use this as the fallback 
 $urlRouterProvider.otherwise('/login'); 


}); 

tab-home.html

<ion-view title="Home">
<ion-content class="padding">


</ion-content>
</ion-view>
2

2 Answers

1
votes

Use "view-title" attribute in tab-home.html

<ion-view view-title="my custom title" >
1
votes

The most probable cause is the path of your templates not being correct. I have created this JSBin and it works fine with minor tweaks to the path of the login.html template. https://jsbin.com/loluva/1/edit?html,js,console,output

<script id="login.html" type='text/ng-template'>
  <ion-view title="Login">
    <ion-content class="padding">

    </ion-content>
  </ion-view>
</script>