Not long ago I hear about glimmer and decide to try it out.
Now I already try to do their tutorial and see the todo-mvc that glimmer already create but it seems that they use navigo to navigate through page.
I want to know if there's any proper way to setup route since previously I use ember.js and to setup route I just need to add another route at router.js.
Because of using navigo now I use code like this to navigate through routes
component.ts
import Component, { tracked } from '@glimmer/component';
import Navigo from 'navigo';
const router = new Navigo(null, true);
export default class MainPage extends Component {
@tracked routeName;
constructor(options){
super(options);
router
.on({
'/': () => { this.routeName = 'home'; },
'/posts': () => { this.routeName = 'postList'; }
})
.resolve();
}
};
template.hbs
<div>
<a href="#/posts"><button>See All Posts</button></a>
{{#if (eq routeName 'postList')}}
<post-list />
{{/if}}
{{#if (eq routeName '404')}}
<h1>PAGE NOT FOUND</h1>
{{/if}}
</div>
Above code is working but it need me to have # after the domain. I think need to find another way or maybe more proper way than this one.
The current answer to your question is that Glimmer does not have such concept as routes. In future, you should be able to install parts of Ember - such as Ember routing to your Glimmer app.
Basically, it will work like this:
Glimmer application -> Installing all Ember packages = Ember application.
Or:
Glimmer application -> Installing only a few Ember packages = Glimmer + parts from Ember such as routing.