ionic-team / ionic-v1

The repo for Ionic 1.x. For the latest version of Ionic, please see https://github.com/ionic-team/ionic
Other
193 stars 187 forks source link

ion-tabs missing after $anchorScroll #50

Open jgw96 opened 7 years ago

jgw96 commented 7 years ago

From @zjx on December 13, 2016 6:24

Ionic version: (check one with "x") [x ] 1.x [ ] 2.x

I'm submitting a ... (check one with "x") [x ] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:

After do $anchorScroll on the tab content then the tabs headers bar will be missing.

Expected behavior:

The tabs header bar should always be displayed on the page.

Related code:

In the html:
<ion-tabs class="tabs-striped tabs-positive tabs-background-aia tabs-color-light tabs-top tabs-icon-left">

        <ion-tab title="tab1" badge="" badge-style="" icon="ion-ios-compose" href="" on-select="" on-deselect="" ng-click="" >
            <ion-content class="has-header has-subheader has-tabs-top">
              <div ng-include src="'question.html'"></div>
            </ion-content>
        </ion-tab>

        <ion-tab title="tab2" badge="" badge-style="" icon="ion-ios-compose" href="" on-select="" on-deselect="" ng-click="" >
            <ion-content class="has-header has-subheader has-tabs-top">
              <div ng-include src="'question.html'"></div>
            </ion-content>
        </ion-tab>
</ion-tabs>

in the Controller:

            $location.hash(targetItem);
            $anchorScroll();
            $location.hash(oldLoc);

Copied from original issue: driftyco/ionic#9611

jgw96 commented 7 years ago

From @zjx on December 14, 2016 2:0

just found a solution, in the top level ion-content, set overflow-scroll=true and scroll=false will resolve my problem. After some investigation there is a clue said anchorScroll does not compatible with ionic and better use the IonicScrollDelegate's scroll, anyway it does not work in my project..