2017-08-31 122 views
0

我正在從事Ionic 1項目。我試圖在其中一個視圖內有一個後退按鈕的導航欄,但沒有出現。我在Chrome上進行了檢查,發現後退按鈕的類別變爲hide。無論如何,我可以讓它出現?離子導航欄的視圖

這裏是我的代碼:

<ion-view ng-controller="GuDetailCtrl"> 
<ion-nav-bar class="bar-positive"> 
<ion-nav-back-button class="button-icon ion-arrow-left-c show"> 
</ion-nav-back-button> 
</ion-nav-bar> 
<ion-content class="padding"> 
<div class="list"> 
    <label class="item item-input"> 
    <span class="input-label">Name</span> 
    <span>{{hotel.name}}</span> 
    </label> 
    <label class="item item-input"> 
    <span class="input-label">Locality</span> 
    <span>{{hotel.locality}}</span> 
    </label> 
    <label class="item item-input"> 
    <span class="input-label">Amenities</span> 
    <span>{{hotel.amenities}}</span> 
    </label> 
</div> 
<button class="button button-positive" ng-click="modal.show()"> 
    Create Booking 
</button> 

<script id="templates/booking.html" type="text/ng-template"> 
    <ion-modal-view> 
    <ion-header-bar class="bar bar-header bar-positive"> 
     <h1 class="title">New Booking</h1> 
     <button class="button button-clear button-primary" ng-click="modal.hide()">Cancel</button> 
    </ion-header-bar> 
    <ion-content class="padding"> 
     <div class="list"> 
     <label class="item item-input"> 
      <span class="input-label">Check-in Date</span> 
      <input ng-model="newBooking.inDate" type="date"> 
     </label> 
     <label class="item item-input"> 
      <span class="input-label">Check-out Date</span> 
      <input ng-model="newBooking.outDate" type="date"> 
     </label> 
     <label class="item item-input"> 
      <span class="input-label">No. of Rooms</span> 
      <input ng-model="newBooking.rooms" type="number"> 
     </label> 
     <button class="button button-full button-positive" ng-click="createBooking(newBooking)">Create</button> 
     </div> 
    </ion-content> 
    </ion-modal-view> 
</script> 

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

回答

0

你可以試試這個code.The頭默認有一個類,如果你沒有明確指定一個,然後返回按鈕將不會出現。您可以在班級中使用bar-lightbar-royal

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

更多,你可以看到here

+0

這個網頁從另一個頁面導航到。父頁面沒有導航欄,所以我不能有一個通用的導航欄類。我嘗試在我的代碼中使用'bar-royal'。顏色改變了,但後退按鈕仍然不顯示。 –

+0

好的,我想你需要看到這個[鏈接](https://stackoverflow.com/questions/32598893/how-to-force-ionic-display-back-button-on-certain-page)希望它能幫助你。 –

+0

謝謝!使用'$ ionicHistory'爲我工作。 :) –