-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Modal's 'resolve' functionality should determine dependency order automatically (like UI.Router) #5030
Comments
Closing as a duplicate of #3405 :) |
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. |
It's definitely not simple - here is UI Router's implementation |
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. |
One thing we could perhaps allow is for users to configure their own resolve handler for the modal. |
+1 That would solve the concerns of duplication of functionality and complexity of implementation. |
@DerekSeverson Please post your workaround. |
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.
The text was updated successfully, but these errors were encountered: