-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Modal - component bindings are not updated #5881
Comments
Yea, we don't support this yet. Please feel free to file a PR. |
Oh, this is a duplicate. Closing as we have #5683. |
I would argue that this is an entire feature set and that implementing this correctly means supporting the feature in its entirety. This was my rationale for closing this. |
Going to reopen this - I don't think this is a duplicate. |
Hm, I'm not sure whether it makes sense for us to duplicate all of the API from Angular's component lifecycle hooks. I think that an appropriate resolution is that when using Angular 1.5, using the new component feature from #6179 makes more sense. What do you think of this resolution? |
@wesleycho Hmm, I think it might be confusing that I can use the component but actually it behaves differently. For me it was weird that I put component in the template and it didn't fire hooks and update bindings. I think using component with modal makes sense when we allow communication between component that opens the modal and component inside modal. If I understand correctly this resolution it is possible through resolve binding. $onChanges hook should fire if resolve binding changes. However, what is missing for me is the way to pass to the modal component & bindings (to have similar behaviour to @output from Angular 2). |
In the case of the modal, it could help to create a wrapper component whose template just contains the component desired to get the event fired. The problem with adding this code for all of the lifecycle hooks is that the implementation under the hood of Angular for executing the $onChanges callback is non-trivial, and I wouldn't want to be caught having to maintain the changes in UI Bootstrap every time it changes internally in Angular - it's fragile, and increases the library code instead of leveraging Angular's built in API. I wish we could have parity with Angular 2 here, but Angular 2 is much more of a component-based framework than Angular 1 is, so the integration is harder for us, especially due to not having that inherent assumption that we are dealing with components. |
I tried to use callbacks ( Is it correct that it is only possible to connect the callbacks from the modal's template to the wrapper template? I have a structure where the grandparent gets the data, the parent needs the data and the child (the modal) needs the data, too. If I now edit the data in the child state, I can call a method in the parent using the callback, but can not call a method in the grandparent using the |
Bug description:
When using new component directives in modal template, the component bindings are not updated correctly.
Link to minimally-working plunker that reproduces the issue:
http://plnkr.co/edit/Jq6fwT?p=preview
After 3 seconds, the component bindings are updated. However, there are no changes in modal. Also $onChanges hook is not fired in component. The same example with component, but without modal:
https://plnkr.co/edit/Rf82S9fCvA35R1kBMAc5?p=preview
After 3 seconds value of bindings are updated and $onChanges hook is called.
Version of Angular, UIBS, and Bootstrap
Angular: 1.5.3
UIBS: 1.3.2
Bootstrap: 3
The text was updated successfully, but these errors were encountered: