I've just started a new project. I'm building a web application, "with native feel", that is going to be run on a remote controlled device in a fullscreen browser (no address bar, fixed resolution). The UI basically consists of multiple fullscreen views. AngularJS is currently the weapon of choice because multiple reasons. I've been trying 'ui-router' and its 'states' to construct the different views. For example:
/#/desktop
/#/menu
/#/videoStore/posterView
/#/videoStore/listView
I very much like having a template, a controller and a URL per view. The fact that the page does not reload when switching views is paramount. However, there are some things I lack.
Double Buffering
I want to be able to prepare the next state/view before transitioning to it. ui-router offers a series of events that will not do. onEnter
, $stateChangeStart
and $stateChangeSuccess
are all called before the state/view controller
is even constructed. I'd rather these events where called on the controller before transition. For example onStart
when it is first started and onResume
on resume.
History behaviour
The state seems to be reconstructed every time I enter it, meaning the template is again added to the DOM and a new controller is instantiated. That is unnecessary and should kill performance. There is no need to reconstruct the menu when leaving the videoStore. Infact, I want to to be able to have it exactly the same, with focus on the same item in subfolders and such without have to recreate it.
Keyhandling
I haven't figured out how to make sure keys go to the right state/view or subview either. I was considering adding a listener to body and then sending the keys to the current scope. Although I do not think that will do because of the uncertainty of which scope is "active" when having multiple views within a state. Some kind of a onFocus
event on the state/view controller would be great. Also, there seems to be no way of getting the "active" scope from angular unless traversing $$ (private) fields.
Alright. Thanks for reading.
Here are my questions:
- Is their some way to "make do" with
ui-router
? I've only evaluated it for two days and might have missed plenty. - Is there a worthy Angularjs alternative to
ui-router
out there? - Are there any other Javascript frameworks out there that does these things similar to how I describe it?