TehShrike / abstract-state-router

Like ui-router, but without all the Angular. The best way to structure a single-page webapp.

Home Page:http://tehshrike.github.io/state-router-example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Proposal to implement empty state

stalkerg opened this issue · comments

I really need to have fake states in the route just for grouping pages.
Currently, we should implement new state and render page with one uiView tag, it looks too complicated and we should have an extra rending pass. Also, our URL became too long.
How I want, example:
A.B.C.D - /a/b/d
A.B.C.E - /a/b/e
but if we will check state to highlight an item in menu A.B.C will be 'active' for both path. C here is the empty state, just for grouping. For .E and .D uiView tag will be from A.B state.
In this case, we still have one path for one state but now possible to use different levels in URL and in the state.

In vue-router some part of similar problem solved by named-views - https://router.vuejs.org/en/essentials/named-views.html
and other by alias.

I do this all the time. Use an empty string for C's route, and a bare-bones pass-through template and you can do whatever other abstract stuff (grouping child states, loading shared dependencies in the resolve function, whatever) for that state.

Does that solve your use case?

Does that solve your use case?

probably yes, at least one. The main goal of this proposal it makes this 'empty state' automatically and reuse parent uiView tag.

Other than the fact that you need a template that contains just <uiView></uiView>, empty states are already supported as far as I can tell.

template that contains just

I suppose we can use parent template.