Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Modal's 'resolve' functionality should determine dependency order automatically (like UI.Router) #5030

Closed
DerekSeverson opened this issue Dec 7, 2015 · 7 comments

Comments

@DerekSeverson
Copy link

Brief: UI.Bootstrap's $uibModal resolve should work more like UI.Router by being able to determine the order that the resolves need to be executed in, based on the dependencies of each resolve.

Plunkr: http://plnkr.co/edit/pUgM6m?p=preview

Details:
When using $uibModal's 'resolve' functionality, UI.Bootstrap should determine the order the resolves need to be resolved in based on the dependencies of each resolve. For example (straight from the plunkr), if resolve 'message' is dependent on the 'user' resolve, the 'user' resolve should be resolved first and once its resolved, only then can 'message' resolve start executing.
Whether this is a bug or a feature request, this request seems reasonably easy to implement seeing that UI.Router resolve already implements it this way. UI Router is open source, so just look at how it does its resolves and do the same. I am not saying to make UI.Router a dependency of UI.Bootstrap; but rather, to implement the modal's resolves in a similar manner that UI.Router does - in order to 'resolve' dependencies in the correct order.

Version/Library Details:
AngularJS: 1.4.*
UI.Router: 0.2.*
UI.Bootstrap: 0.14.*

NOTE:
I actually saw that there was an issue already, but was closed due to no response (and there was no plunkr) - Issue #1959. So unfortunately, the feature was not implemented.

Let me know if you have questions, this feature would be much appreciated.

@wesleycho
Copy link
Contributor

Closing as a duplicate of #3405 :)

@pkozlowski-opensource
Copy link
Member

Is it worth it on this library side? If I understand correctly it is very easy to do it on the user side by just having one function in resolve.

I'm not convinced that additional complexity, code size and (small) runtime penalty is worth it. -1 from me, but happy to be convinced otherwise if the code turns out small (<10 LOC) and straightforward.

@wesleycho
Copy link
Contributor

It's definitely not simple - here is UI Router's implementation

@DerekSeverson
Copy link
Author

I apologize for the duplicate Issue. Thank you for the quick response. I was just about to link the UI Router's implementation of their $resolve service.

Well, I guess I'll just use the $resolve service in UI.Router directly to get around $modal's resolve. If you'd like, I could post my workaround for others who have the same issue.

@wesleycho
Copy link
Contributor

One thing we could perhaps allow is for users to configure their own resolve handler for the modal.

@DerekSeverson
Copy link
Author

+1 That would solve the concerns of duplication of functionality and complexity of implementation.

@neerajjain92
Copy link

@DerekSeverson Please post your workaround.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants