导航到标签页时,不会更新离子2离子选项卡

时间:2017-03-22 01:43:30

标签: php html angular ionic2

页面A显示从数据库获得的一些信息(表A)。页面A中有一个按钮,单击时将导航到另一个带有表单(表单页面)的页面。当我提交表单时,将运行一个PHP函数并将新记录插入到表A中。成功执行PHP函数后,它会将我重定向回选项卡页面的根目录(即主页)。当我尝试重定向回到页面A时,通过单击离子选项卡按钮,页面A不会显示我所做的任何更新。我希望页面A再次从数据库中获取数据(表A)

我已经检查了我的数据库,并在提交表单时更新了表格

formPage.ts

    // This function updates Table A
    this.http.get(url).map(res => res.json()).subscribe(data => {
      if( data['success'] == true) {
          this.navCtrl.push(TabPage, { userId: this.userId });
      };
    }, 
        err => { console.log(err); }
    );

tabPage.ts

  constructor(public navCtrl: NavController, public navParams: NavParams){
      this.navParams = navParams;
      // I used data because I submit login data from login page
      // userId will get data from both login page and from formPage
      this.userId = this.navParams.data;
   }

tabPage.html

    <ion-tabs>
        <ion-tab [root]="pageA" [rootParams]="userId"></ion-tab>
    </ion-tabs>

Page A.ts

    constructor(public navCtrl: NavController, public navParams: NavParams, private HttpServices: HttpServices, private App: App, public loadingController: LoadingController) {
        this.userId = this.navParams.get('userId');
        this.HttpServices.fetchFromTabelA(this.userId).subscribe(data => {
            this.data = data;
        },
            err => { console.error(err); }
        );
    }

TL;博士      - 页面未显示对数据库进行的任何更新

0 个答案:

没有答案