2015-08-29 31 views
1

我有一個在登錄/登錄過程中隱藏的離子導航欄。登錄後,我會在頂部的導航欄上標記底部。離子導航欄可以看到,但標題沒有顯示任何東西。我究竟做錯了什麼?任何幫助,將不勝感激。爲什麼標題不能顯示在ion-nav-bar上?

的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'); 


}); 

製表home.html的

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


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

回答

1

使用 「查看標題」 屬性的製表home.html的

<ion-view view-title="my custom title" > 
+0

感謝您的回覆。我試過查看標題,但酒吧仍然是空白的,還有其他想法? – chuck280

1

最可能的原因是您的模板路徑不正確。我創建了這個JSBin,它可以很好地對login.html模板的路徑進行微調。 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> 
相關問題