# Tab selection does not work as exepected

**URL:** <https://forum.ionicframework.com/t/tab-selection-does-not-work-as-exepected/109876>\
**Category:** ionic-v3\
**Created:** [October 25, 2017, 5:31am UTC](https://forum.ionicframework.com/t/tab-selection-does-not-work-as-exepected/109876 "2017-10-25T05:31:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vikceo](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/vikceo/32/110016_2.png) [@vikceo](https://forum.ionicframework.com/u/vikceo)\
**Post date:** [October 25, 2017, 5:31am UTC](https://forum.ionicframework.com/t/tab-selection-does-not-work-as-exepected/109876/1 "2017-10-25T05:31:27Z")

</div>

I am using ionic 3 angular and building a web application. One of the requirement i am having is a tabs component with first tab showing a list. clicking each of list item creates a new tab and shows some contents.

The way I implemented it is:

```auto
     <ion-tabs #myTabs tabsPlacement="top" tabsLayout="icon-end">
                    <ion-tab *ngFor="let tb of core.dynamicTabs" [root]="tb.pageName" tabTitle="{{tb.tabTitle}}" tabIcon="close" (ionSelect)="onTabActive($event)"></ion-tab>
              </ion-tabs>

```

I am keeping a shared array to store tab related data like

```auto
 @Injectable()
    export class CoreStructureProvider {
        dynamicTabs:any[];
    
      constructor(public http: Http) {
        this.dynamicTabs = [{ "pageName": MyListPage, "tabTitle" : rw.name, "optyId": rw.OptyId }];
      }

```

So from the first tab’s page the code to create new tabs is:

```auto
     createTab(rw){
                 this.core.dynamicTabs.push( { "pageName": EditOptyPage, "tabTitle" : rw.name, "optyId": rw.OptyId });
    (this.navCtrl.parent).select(1)
    
           }

```

Everything works great except the tab selection. Just to simplify the problem i hardcode value to 1. So ideally everytime createTab is called the 2nd tab should be selected.

But here is the behavior that i am seeing:  
when you come first time: there is just one tab showing the list. you click one of the items on the list and a new tab gets created. however that does not become the active tab.

now click one more time on any other link in the list and this time and from now onwards the 2nd tab becomes active.

So I am not sure why first time this does not trigger?
