离子导航栏标题没有显示

时间:2015-05-01 14:27:03

标签: javascript angularjs

我开始用angularjs学习离子。我的屏幕标题有问题。它位于代码中,但在localhost或移动设备上运行时未在浏览器中显示。导航栏中有特定的模板,但标题为。谢谢您的帮助。抱歉,嵌入错误的代码:|

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>

1 个答案:

答案 0 :(得分:0)

如果我在 index.html 中设置导航栏,它对我有用:

&#13;
&#13;
<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>
&#13;
&#13;
&#13;

我不知道为什么你的解决方案无法正常工作,但只要你不需要在某处工作就可以隐藏导航栏。