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

Modal - component bindings are not updated #5881

Open
Olgagr opened this issue May 8, 2016 · 9 comments
Open

Modal - component bindings are not updated #5881

Olgagr opened this issue May 8, 2016 · 9 comments

Comments

@Olgagr
Copy link

Olgagr commented May 8, 2016

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

@icfantv
Copy link
Contributor

icfantv commented May 8, 2016

Yea, we don't support this yet. Please feel free to file a PR.

@icfantv
Copy link
Contributor

icfantv commented May 8, 2016

Oh, this is a duplicate. Closing as we have #5683.

@Olgagr
Copy link
Author

Olgagr commented May 8, 2016

@icfantv Yeah, sorry, I've made separate issue for that to stand it out :) #5683 is a little bit other discussion.

@icfantv
Copy link
Contributor

icfantv commented May 8, 2016

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.

@wesleycho
Copy link
Contributor

Going to reopen this - I don't think this is a duplicate.

@wesleycho
Copy link
Contributor

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 wesleycho added this to the Purgatory milestone Aug 20, 2016
@Olgagr
Copy link
Author

Olgagr commented Aug 20, 2016

@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).

@wesleycho
Copy link
Contributor

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.

@v1r0x
Copy link

v1r0x commented Jul 28, 2017

I tried to use callbacks (&) in a modal for the last two days. I understand that you don't want to (in regards to reimplementing angular) implement this feature, but I'd suggest that there should be an info that there are no callbacks or how they can be achieved (using the wrapper workaround).

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 &binding?

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

No branches or pull requests

4 participants