2016-05-14 12 views
1

ナビゲーションバーのアイコンは、ポジションの真/偽のトグルに従って表示するかどうかを示します。ビューのテストは完全に機能しますが、結果はナビゲーションバーでは機能しません。どちらのページも同じコントローラを使用します。翻訳英語Ionic - アイテムは、ナビゲーションバーの双方向データバインディングを実行します。

のindex.html - NAV-バー

<ion-nav-bar class="bar-stable" ng-controller="DashCtrl"> 
    <ion-nav-buttons side="right"> 
    <i class="icon ion-eye ng-show="vaovivo.valor"></i> 
    </ion-nav-buttons> 
<ion-nav-bar 

Account.html -

<ion-toggle ng-model="vaovivo.valor" ng-checked="vaovivo.valor"> 
    Modo ao Vivo 
</ion-toggle> 

Controllers.js

angular.moduleトグル(」 [startter.controllers]、[])

.controller('DashCtrl', function($scope,$rootScope) {  
    $scope.vaovivo = {'valor':false} 
}) 

app.js

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

    $stateProvider 

    // 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.dash', { 
    url: '/dash', 
    views: { 
     'tab-dash': { 
     templateUrl: 'templates/tab-dash.html', 
     controller: 'DashCtrl' 
     } 
    } 
    }) 
    .state('tab.account', { 
    url: '/account', 
    views: { 
     'tab-account': { 
     templateUrl: 'templates/tab-account.html', 
     controller: 'DashCtrl' 
     } 
    } 
    }); 

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

}); 

がUPDATE: のindex.html - NAV-バー

<ion-nav-bar class="bar-stable" ng-controller="DashCtrl"> 
    <ion-nav-buttons side="right"> 
    <i class="icon ion-eye" ng-show="vaovivo.valor"></i> 
    </ion-nav-buttons> 
<ion-nav-bar> 
+0

経路ファイルを表示できますか? – sumair

答えて

0

ロジックが健全に見えますが、その一つのことがありますnav-barでng-showが機能しない可能性があります。あなたはion-nav-barを適切に閉じるわけではありませんし、問題かもしれません。まず

、適切に終了引用符

<i class="icon ion-eye" ng-show="vaovivo.valor"></i> 

第二に、適切にイオンナビゲーションバーを閉じるを追加することによって、のようなNG-クラスの近隣にあります。

</ion-nav-bar> 
+0

基本的な間違いをおかけして申し訳ありませんが、コードを転記することでした。問題は続く。 – alebarros

関連する問題