Switching to tab using select does not work


#1

I have a tabs component with one static tab and few generated on the fly. It looks like below

 <ion-tabs #myTabs tabsPlacement="top" tabsLayout="icon-end" style="min-height: 500px;margin-left:14px;" no-border selectedIndex="{{core.activeTabIndex}}">
                <ion-tab [root]="optyList" tabTitle="Opportunities"></ion-tab>
                <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 trying to switch to the newly created tabs like:

  this.events.subscribe('switch-tab', 
                    (val) => this.tabs.select(val)
                )

but nothing happens. i have cofirmed i am geting the val every time a new tab is created.


#2

.val will not create anything if your script can’t do it at higher level (sudo admin or root rights to be able to write on server). Not to mention, this is a nice try but, in the end your app will have serious performance issues trying to code tabs on the fly.

Regards,


#3

sorry but i did not even understand what you mean by this. I am able to create tabs and works all great. The problem is switching to the tab.


#4

.val in your code will ask for server rights, which in most cases will be refused if not logged in as root or superuser (that means this code will never work in production with guest people on your server).

hope it helps,


#5

and @vikceo for example in an ecommerce website, you want to accept guest in any apache session

francois


#6

what is this .val you are talking about that will need all these rights etc. ? I am somehow lost and feel we are talking two different things. Kindly enlighten


#7
this.events.subscribe('switch-tab', 
                    (val) => this.tabs.select(val)
                )

this part of your code, Vik can call to .val…
it seems i was wrong from the start.


#8

You mean your responses so far do not apply to this question ?


#9

I mean for the .var that can be hacked easily if not taken care of with apache or nginx for example.