Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70435

Changing Navigation Stack content

$
0
0

@donotsue wrote:

Hi there,

hope you’re enjoying Ionic 4 like I do :slightly_smiling_face: But I found a question for you on my journey building a little store administration.

It’s a page based (not tab based) app.

  1. Starting simply on the “Homepage”

  2. A click in sidemenu and navigating with
    this.navController.navigateForward('/search-products/0')
    to page

  3. I got a list here now. Click on an item for an editing formular navigates to
    this.navController.navigateForward('/edit-product')
    (ID-Transfer of the item solved over services, not over GET-params, so … but this is not the point)

Now the excelent working pain: When I “save” the changes on the edit formular of the 3. step above, I needed to get back explicitly to ‘/search-products/1’. This is no problem, when the user clicks on save button and the event handler calls
this.navController.navigateBack('/search-products/1')
(please notice the difference of the first value)

Everything nice and dandy :slight_smile: But … what, if the user pushs his back button on the phone or the back button in the app or even the browser when ionic serve-ing? Then I allthough needed to get “back” to '/search-products/1', but this navigation path was not in the above stack …

Question: How to do that?

The workaround I used so far
This way I’m using works “excelente”, but it doesn’t feel or even seem to be the right way:

  1. Again: Starting simply on the “Homepage”
  2. A click in sidemenu and navigating with
    this.navController.navigateForward('/search-products/0')
    to page

now the difference …

  1. I got a list here now. Click on an item for an editing formular navigates to
      this.navController.pop().then(() => { // Going back to Homepage
        this.navController.navigateForward('/search-products/1').then(() => { // come back with other parameter
          this.navController.navigateForward('/edit-product').then(() => { // and NOW go to edit formular
            // do stuff here ...
          });
        });
      });

It looks really funny when the pages are changing quickly like an automated bot using the app, but … naaaaah … This is not the right way, I feel that. No other app was acting like this I’ve seen ever before, so … How do I solve this?

Thank you for any help and sorry for the novel I wrote …

Big kisses

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70435

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>