Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/31.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
Angular 离子4离子标签导航问题:按下“后退”按钮时,会转到上一个标签,而不是上一页_Angular_Ionic Framework_Ionic4 - Fatal编程技术网

Angular 离子4离子标签导航问题:按下“后退”按钮时,会转到上一个标签,而不是上一页

Angular 离子4离子标签导航问题:按下“后退”按钮时,会转到上一个标签,而不是上一页,angular,ionic-framework,ionic4,Angular,Ionic Framework,Ionic4,我有两个应用程序:一个是服务提供商的,另一个是普通用户的(有点像抓取和抓取驱动程序)。两者都非常相似(除了一些只为服务提供商专用的页面),其中一个功能是消息和查询。这两个应用程序的消息传递实现非常相似 我有一个messenger页面,它有两个选项卡:聊天和查询。问题来了,当我浏览用户应用程序中的选项卡时,我觉得它似乎在向堆栈中添加页面。流程如下: 我打开应用程序,主页显示 我打开messenger页面,显示聊天选项卡 我点击查询选项卡,查询选项卡显示 我按下后退按钮,它会返回聊天选项卡(应该返回

我有两个应用程序:一个是服务提供商的,另一个是普通用户的(有点像抓取和抓取驱动程序)。两者都非常相似(除了一些只为服务提供商专用的页面),其中一个功能是消息和查询。这两个应用程序的消息传递实现非常相似

我有一个messenger页面,它有两个选项卡:聊天和查询。问题来了,当我浏览用户应用程序中的选项卡时,我觉得它似乎在向堆栈中添加页面。流程如下:

  • 我打开应用程序,主页显示
  • 我打开messenger页面,显示聊天选项卡
  • 我点击查询选项卡,查询选项卡显示
  • 我按下后退按钮,它会返回聊天选项卡(应该返回主页)
  • 但是,当两个应用程序中的实现相同时,它可以在服务提供商应用程序上正常工作。应用于与上述相同的情况,它在服务提供商应用程序中以这种方式工作(我希望它以这种方式工作):

  • 我打开应用程序,主页显示
  • 我打开messenger页面,显示聊天选项卡
  • 我点击查询选项卡,查询选项卡显示
  • 我按下后退按钮,它就会回到主页
  • 下面是代码,因为两个应用程序使用相同的代码,我将粘贴它们一次:

    messenger.ts:

    <ion-tabs>
        <ion-tab-bar slot="top">
    
          <ion-tab-button tab="chats">
            <ion-label><strong>Chat</strong></ion-label>
          </ion-tab-button>
    
          <ion-tab-button tab="inquiries">
            <ion-label><strong>Inquiries</strong></ion-label>
          </ion-tab-button>
    
        </ion-tab-bar>
    </ion-tabs>
    
    import { NgModule } from '@angular/core';
    import { CommonModule } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import { Routes, RouterModule } from '@angular/router';
    
    import { IonicModule } from '@ionic/angular';
    
    import { MessengerPage } from './messenger.page';
    
    const routes: Routes = [
      {
        path: 'tabs',
        component: HealthMessengerPage,
        children: [
          {
            path: 'chats',
            loadChildren: '../chats/chats.module#ChatsPageModule'
          },
          {
            path: 'inquiries',
            loadChildren: '../inquiries/inquiries.module#InquiriesPageModule'
          },
        ]
      },
      {
        path: '',
        redirectTo: 'tabs/chats',
        pathMatch: 'full'
      }
    ];
    
    @NgModule({
      imports: [
        CommonModule,
        FormsModule,
        IonicModule,
        RouterModule.forChild(routes)
      ],
      declarations: [MessengerPage]
    })
    export class MessengerPageModule {}
    
    我不确定我哪里做错了。有人能帮忙吗

    更新

    我似乎无法找出这是什么原因,所以我将所有内容复制到一个新的项目文件中,并将其删除 现在一切正常

    更换离子返回按钮

    <ion-back-button [routerLink]="'/home'" defaultHref="home"></ion-back-button>
    
    
    
    不确定,但可能与此错误有关。您是否提供了
    messenger.html
    而不是
    messenger.ts
    ?@IanP。它们是ts文件。他们在另一个应用程序中运行良好,尽管代码与我认为的@CyrilHanquez完全相同,但这可能是一个错误。最后,我将整个应用程序复制到一个新的ionic项目中,它运行良好。尝试了一下,但不起作用。以前,页面没有后退按钮,但它在其中一个应用程序上的工作方式符合我的要求。