Skip to content

Clearing tabview page-router-outlets is not working #1502

Closed
@FBorgonjen

Description

@FBorgonjen

Since nested page-router-outlets are not yet supported (see #1351), our application consists of a login in a modal and a tabview with multiple page-router-outlets. After a user is logged in, the login modal disappears and the individual pages are loaded in the tab-view. This works as expected.

In one of the tab-view pages we have a logout button that should unload all the pages in the tab-view and re-open the login modal. Our approach is to use an outlet navigation to null-pages, like so:
this.router.navigate([{ outlets: { firstTab null, secondTab: null } }], { relativeTo: this.activatedRoute.parent });
(I found this solution in angular/angular#5122 and I've also tried all other suggested approaches)

Unfortunately this doesn't work in our application.

Since we've already altered our approach using a login page in a modal instead of nested-routing, we have to find a solution to unload the pages in the tab-view. This issue, combined with issue 1351 puts us into a deadlock..

Any suggestions?

Which platform(s) does your issue occur on?

  • Both iOS and Android on emulator and devices

Please, provide the following version numbers that your issue occurs with:

  • CLI: 4.2.2
  • Cross-platform modules: 4.2.0
  • Runtime(s): 4.2.0
  • Plugin(s): (see playground example)

Please, tell us how to recreate the issue in as much detail as possible.

Is there any code involved?

Playground: https://play.nativescript.org/?template=play-ng&id=8eLtNS&v=10

Open the playground example.
Click on 'Perform successful login' to mimic a login >> Logout >> Click on 'Perform successful login' again. (Login functionality can be found in modal/login.component.ts. Logout functionality can be found in home/home.component.ts)

As you can see, the contents of the tab-view are not unloaded, and a duplicate home and browse page is loaded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions