当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - ionic nav-bar title doesn't show

问题描述:

I started learning ionic with angularjs. I have a problem with the title on the screen. It is in the code but didn't shown in browser when running in localhost or either on mobile. The navbar is there with the specific template but the title no. Thanks for the help. Sorry for the badly embed codes :|

angular.module("veganApp", ["ionic"])

.run(function($ionicPlatform) {

$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) {

cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);

}

if (window.StatusBar) {

// org.apache.cordova.statusbar required

StatusBar.styleDefault();

}

});

})

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

$stateProvider

.state('home', {

url: "/home",

templateUrl: "app/home/home.html"

});

// if none of the above states are matched, use this as the fallback

$urlRouterProvider.otherwise('/home');

});

<!-- begin snippet: js hide: false -->

<ion-nav-bar class="bar-balanced">

<h1 class="title">Meal Plan</h1>

</ion-nav-bar>

<ion-tabs class="tabs-balanced tabs-icon-top">

<ion-tab title="Meal Plan" icon="ion-ios-list-outline" href="#">

<ion-view></ion-view>

</ion-tab>

<ion-tab title="Shopping List" icon="ion-ios-cart-outline" href="#">

<ion-view></ion-view>

</ion-tab>

</ion-tabs>

网友答案:

It works for me if I set the nav-bar in index.html like this:

<body ng-app="yourApp">

  <ion-nav-bar class="bar-stable"><ion-nav-back-button></ion-nav-back-button>
  </ion-nav-bar>

<ion-nav-view></ion-nav-view>
</body>
分享给朋友:
您可能感兴趣的文章:
随机阅读: