-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Add $resolve to uibModal scope #5808
Comments
@radarfox, are you planning to fill out the issue description or was this created by mistake? |
closing due to lack of content. |
Sorry, i accidentaly pressed enter before entering description. You are too fast for me :) Now is all set, could you reopen? |
@radarfox, i'm not seeing a $resolve property in the docs page you linked. regardless, if this is an angular 1.5.x thing, we are not yet ready to require angular 1.5+. |
@radarfox, is this somehow different than the scope property you can pass into open?
|
@icfantv It is located near the end of page - Properties -> current Well it is not 100% Angular 1.5. It is just adding resolved object to modal scope. It is not requiring any 1.5 functionality. |
@deeg no, it should be bound to modal scope - child scope of scope passed in options. It is the same scope where $close and $dismiss is bound to. |
@radarfox do you mean |
I guess I'm still confused on the difference between scope and resolve options your propose. Could you maybe set up a plunker with how you want resolve to work so we can better understand? |
@icfantv well |
@deeg here it is http://plnkr.co/edit/UtTBUZoztzVS8A5jcoQq If support for |
Also ui-router implemented support for this - https://github.com/angular-ui/ui-router/releases/tag/1.0.0-alpha.1 (see the first paragraph of "Route to component") And i found more detailed info on angular-route https://docs.angularjs.org/guide/component#components-as-route-templates @deeg is this enought info for you? |
@radarfox, is there a reason something like this wouldn't work? That uses the already in place scope option instead of the newly created resolve option. Sorry if I'm missing something completely. |
@deeg no, because that would not work with promises, like resolving does. |
I can't say I love this suggestion, but I know ngRoute and UI Router have both went this route. For parity, it may be better for us to just support this. |
@radarfox, I see. None of the examples you provided showed promises that is why I was confused. Agree with you now though! |
I hope it is clear that this is 100% backwards compatible enhancement, which takes only 2 lines of code to implement. I see no performance or compatibility problems. As a result you save a lot of code, when using component aproach with multiple modals. |
@radarfox, yes that is clear. Feel free to open a PR and we can review it and merge it in. |
It actually has a bit of negative perf implications, since the dirty checking loop becomes longer, but it seems that those concerns are fairly weak, or weak enough that this was not a strong point of consideration for both the Angular and UI Router teams. |
@pcalouche there were multiple things wrong with your Plunker - see here. In the future, please do not open issues/pollute existing issues for what are support issues. |
@wesleycho Thanks for implementation and release. The only disadvantage is that you also need Why did you implement it differently from how |
@wesleycho also angular-route does not require |
Hello,
it would be super, if modal plugin would support new
$resolve
property same as angular-route does.See example here (search for "$resolve") https://docs.angularjs.org/api/ngRoute/service/$route
It makes usage with components much easier, because there is no need for "modal controller", just the "component controller":
Then in component just add bindings, and everything is set:
All I had to do, was to add 2 new lines in your source:
and
Plunker http://plnkr.co/edit/UtTBUZoztzVS8A5jcoQq
Example in angular-route https://docs.angularjs.org/guide/component#components-as-route-templates
The text was updated successfully, but these errors were encountered: