Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typescript 提交表单后切换到其他选项卡_Typescript_Ionic2 - Fatal编程技术网

Typescript 提交表单后切换到其他选项卡

Typescript 提交表单后切换到其他选项卡,typescript,ionic2,Typescript,Ionic2,当用户单击时,在选项卡之间导航非常有效,而我目前正在做的事情是,在用户提交表单后,我尝试切换到其他选项卡 tabs.html <ion-tabs [selectedIndex]="{{changTab}}"> <ion-tab tabTitle="Home" [root]="setTab1" tabIcon="home"></ion-tab> <ion-tab tabTitle="Search" [root]="setTab2" tab

当用户单击时,在选项卡之间导航非常有效,而我目前正在做的事情是,在用户提交表单后,我尝试切换到其他选项卡

tabs.html

<ion-tabs  [selectedIndex]="{{changTab}}">
    <ion-tab tabTitle="Home" [root]="setTab1" tabIcon="home"></ion-tab>
   <ion-tab  tabTitle="Search" [root]="setTab2" tabIcon="search"></ion-tab>
   <ion-tab  tabTitle="Lessons" [root]="setTab3" tabIcon="book"></ion-tab>
   <ion-tab  tabTitle="Notifications" [root]="setTab4" tabIcon="star"></ion-tab>
   <ion-tab  tabTitle="Account" [root]="setTab5" tabIcon="person"></ion-tab>
 </ion-tabs>

试试这个,我希望对你有帮助

创造

import { Component, ViewChild } from '@angular/core';
 export class ClassName {
   /*ADD this inside your class */
   @ViewChild("paymentTabs") paymentTabs: Tabs;
加在这里

 /* add paymentTabs  with # ion-tabs*/
<ion-tabs #paymentTabs [selectedIndex]="{{changTab}}">

我希望它能对您有所帮助。

您是否为选项卡创建了@ViewChild?请告诉我如何创建
 /* add paymentTabs  with # ion-tabs*/
<ion-tabs #paymentTabs [selectedIndex]="{{changTab}}">
  /* Select tab via index*/
this.paymentTabs.select(1);