Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic where to put header and top navbar in ion-view?

I'm trying to put header and top navbar inside of the ion-view directive.

If I put header nav navbar outside of the ion-view tag page is blinking black if page is initialized.

But if I try to insert header and top navbar inside of the ion-view title and heading in the header is not displayed.

Could somebody tell me what I'm doing wrong?

Maybe some tag inside is missing?

Thanks for any help.

Here is the code of the template:

<div class="bar bar-header bar-positive has-tabs-top">
    <button class="button button-icon icon  ion-chevron-left" ui-sref="home">
    </button>
    <h1 class="title">{{ 'RESULTS_BY_DAY' | translate }}</h1>
    <button class="button button-icon icon ion-stats-bars" ui-sref="daily-chart">
    </button>
</div>

<!--TOP TAB BAR -->
<div class="tabs-striped tabs-top tabs-background-light tabs-light tabs-color-dark">
    <div class="tabs">
      <a class="tab-item orange">
        Home
      </a>
      <a class="tab-item">
        Favorites
      </a>
      <a class="tab-item">
        Settings
      </a>
    </div>
</div>

<ion-view>
<div class="bar bar-header bar-positive has-tabs-top">
    <button class="button button-icon icon  ion-chevron-left" ui-sref="home">
    </button>
    <h1 class="title">{{ 'RESULTS_BY_DAY' | translate }}</h1>
    <button class="button button-icon icon ion-stats-bars" ui-sref="daily-chart">
    </button>
</div>

<!--TOP TAB BAR -->
<div class="tabs-striped tabs-top tabs-background-light tabs-light tabs-color-dark">
    <div class="tabs">
      <a class="tab-item orange">
        Home
      </a>
      <a class="tab-item">
        Favorites
      </a>
      <a class="tab-item">
        Settings
      </a>
    </div>
</div>
  <ion-content  ng-controller="DailyListCtrl">

      <!--WRITEOUT OVERAL STATS FOR DAYS -->
      <ion-list class="list" >
          <ion-item class="item itemListCustom" ng-repeat="listDataItem in listData">

                  <div class="listDateTimeBlock">
                    <div class="day"><h3>{{listDataItem.DATE_FROM_DD}}</h3></div>
                    <div class="month"><h3>{{listDataItem.DATE_FROM_MM}}</h3></div>
                  </div>

                <!--ROW ONE -->                  
                <div id="left">
                    <div class="left-inner">
                        {{ 'APPOINTMENT_SUCCESS_RATE' | translate }}:
                    </div>
                    <div class="right-inner">
                        {{listDataItem.SUCCESS_RATE}} %
                    </div>
                </div>
                <div id="right">
                    <div class="left-inner floatRight">
                        {{ 'DIALS' | translate }}:
                    </div>
                    <div class="right-inner">
                         {{listDataItem.DIALS_CNT}}
                    </div>
                </div>

                <!--ROW TWO-->
                <div id="left">
                    <div class="left-inner ">
                        {{ 'SUCCESS_RATE_SINCE_START' | translate }}:
                    </div>
                    <div class="right-inner">
                        {{listDataItem.SUCCESS_RATE_SINCE}} %
                    </div>
                </div>
                <div id="right">
                    <div class="left-inner floatRight">
                        {{ 'CONVERSATIONS' | translate }} :
                    </div>
                    <div class="right-inner">
                         {{listDataItem.CONVERS_CNT}}
                    </div>
                </div>                  

                <!--ROW THREE-->
                <div id="left">
                    <div class="left-inner">
                        {{ 'MY_DEFICIT' | translate }}:
                    </div>
                    <div class="right-inner">
                        {{listDataItem.DEFICIT}} %
                    </div>
                </div>
                <div id="right">
                    <div class="left-inner floatRight">
                       {{ 'APPOINTMENTS' | translate }} :
                    </div>
                    <div class="right-inner">
                       {{listDataItem.APPT_CNT}}
                    </div>
                </div>                  
          </ion-item>
      </ion-list>

   <ion-infinite-scroll
      icon="ion-loading-c"
      distance="30%"
      on-infinite="setDateRange();">
    </ion-infinite-scroll>

  </ion-content>

  <!-- BOTTOM TABS -->
     <div class="tabs-striped tabs-background-positive tabs-light">
    <div class="tabs">
      <a class="tab-item active" ui-sref="daily-list" href="/#/daily-list">
        <i class="icon ion-ios7-paper-outline"></i>
      </a>
      <a class="tab-item" ui-sref="weekly-list" href="/#/weekly-list">
        <i class="icon ion-star"></i>
      </a>
      <a class="tab-item" ui-sref="daily-list" href="/#/daily-list">
        <i class="icon ion-gear-a"></i>
      </a>
       <a class="tab-item" ui-sref="daily-list" href="/#/daily-list">
        <i class="icon ion-gear-a"></i>
      </a>
    </div>
    </div>
</ion-view>
like image 771
redrom Avatar asked Dec 02 '14 18:12

redrom


Video Answer


1 Answers

Here are some examples of navbar usage:

  • Simple page with buttons left and right:

http://codepen.io/beaver71/pen/YwLELa

  <ion-view title="onepage">
    <ion-nav-buttons side="left">
      <button class="button">
        LeftButton
      </button>
    </ion-nav-buttons>        
    <ion-nav-buttons side="right">
      <button class="button button-assertive">
        RightButton
      </button>
    </ion-nav-buttons>        

    <ion-content class="padding">
      <!-- The content of the page -->
    </ion-content>
  </ion-view>
  • Navigation via side menu:

http://codepen.io/beaver71/pen/XXBvYp

  • Navigation via side menu and tab bar:

http://codepen.io/beaver71/pen/xZWXBO

like image 167
beaver Avatar answered Oct 07 '22 23:10

beaver