Ionic Router without Frameworks

Hello! I am using Ionic without any Framework. How can I use the router? In the Docs there is this:

    customElements.define('nav-home', class NavHome extends HTMLElement {
      connectedCallback() {
        this.innerHTML = `
          ... HTML CODE HERE ...
        `;
      }
    });

How can I split it into files? I tried using:

customElements.define('nav-home', class NavHome extends HTMLElement {
      connectedCallback() {
        $(this).load('myfile.html');
      }
    });

with jQuery, but It is not a good idea. What do you use? Thanks!

I wouldn’t suggest doing this to be honest.
I’d highly suggest using a framework here if you want to use the router.
Aside from proper structure and architecture of an app, the router itself is more tied to a framework.

1 Like