Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider using ui-router for application state #51

Closed
jniles opened this issue Jan 28, 2016 · 3 comments
Closed

Consider using ui-router for application state #51

jniles opened this issue Jan 28, 2016 · 3 comments

Comments

@jniles
Copy link
Collaborator

jniles commented Jan 28, 2016

The application has never handled state well. For simple cases (do we have a primary cashbox or not?), the controller has often just used an ng-if directly in the HTML to show/hide components. For more complex cases, the controller uses an ng-switch (create/update/success/failure). Admin modules are good examples of these. In the most complex cases, sometimes an ng-switch is coupled with an ng-include and even a new controller is templated in. Receipts is a good example of this condition.

One solution is to use the router to manage state. Our current router (ngRouter) is limited to only directly mapping URLs to individual templates and controllers, 1-1-1. A different project, ui-router allows you to nest controllers and views, so that child states can inherit properties of the parent states, and you can have multiple views on a single page (we currently only have on ng-view).

Advantages of ui-router:

  1. Can create easily compose separate states for create/update/views for common CRUD modules (e.g. users, projects, enterprises, locations, etc, ...).
  2. Easily nest states (/patients <- /patients/:id <- /patients/:id/groups) to reduce the need for services and extra $http requests.
  3. Multiple views!
  4. No longer have to depend on the URL to change to switch controllers -- allows us to better encapsulate complex pages.

Dis-advantages of ui-router:

  1. No idea how it will compose with Angular 2. They are working on it though.

link.

@DedrickEnc
Copy link
Contributor

@jniles what is the label for this issue?

@jniles
Copy link
Collaborator Author

jniles commented Jan 29, 2016

Not sure. Proposal? Design? Discussion? Something like that.

@sfount
Copy link
Contributor

sfount commented Feb 1, 2016

@IMA-WorldHealth/local-contributors I will investigate what it would mean to transition to UI-router today and report back in this thread.

@sfount sfount self-assigned this Feb 1, 2016
@sfount sfount added this to the Bhima-Utils milestone Feb 1, 2016
@sfount sfount removed this from the Bhima-Utils milestone Mar 23, 2016
jniles referenced this issue in jniles/bhima Jan 6, 2017
This commit removes the text "ID" from the receipts.

Closes #51.
jniles referenced this issue in jniles/bhima Jan 7, 2017
This commit removes the text "ID" from the receipts.

Closes #51.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants