Back button leaves URL address unchanged


#1

Hello everyone,

I wrote a little bit of code to generate a dynamic menu, defined via JSon file.
For sure there are many other better solutions but I didn’t find one yet.

I have shared the code on GitHub, and if you have the chance to try it, you can see that once you get into a “LeafPage” and then press the back arrow, the address in the URL bar remains like this: http://localhost:8100/#/leaf instead of going to be http://localhost:8100/

I don’t know if this can be a problem, but can this be avoided? I’ve read some bug report but unable to understand if it is really a bug or not.

Thanks in advance


#2

Hi all!

I think I have solved this issue moving the JSon menu into the home page ts file.
This way I can refer directly to the LeafPage page component, not by its string name but by the Class name (imported on top of the TS file).

So the menu is defined like this in the home.ts file:

menu: any = [
      {
          id: "entry1",
          name: "Entry 1",
          children: [
              {
                  id: "entry1.1",
                  name: "Entry 1.1",
                  page: LeafPage
              },
              {
                id: "entry1.2",
                  name: "Entry 1.2",
                  children: [
                      {
                        id: "entry1.2.1",
                          name: "Entry 1.2.1",
                          page: LeafPage
                      }
                  ]
              }
          ]
      },
      {
          id: "entry2",
          name: "Entry 2",
          page: LeafPage
      }
  ];

Changes committed on github