-
-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Component bindings are bound too late #270
Comments
Right, the issue for the bindings being bound too late is that they are only put on the scope once the controller is being run. If the bindings are placed on the injected scope directly, then the issue vanishes and |
Anyone able to make a quick PR w/ tests to show the correct behaviour? |
This ensures that component bindings are available in the $onInit callback of the component's lifecycle This addresses the main issue brought up by dwmkerr#270
This ensures that component bindings are available in the $onInit callback of the component's lifecycle This addresses the main issue brought up by dwmkerr#270
Apologies, I didn't notice this issue when it was first brought up. Funny enough we ran into this ourselves internally, so I just pushed #280 to address the $onInit issue. The attribute and output bindings issues you brought up are trickier issues, so I didn't address those here. It's not ideal, but like you noticed using a one-way input binding for these instead works. I've added a note to the readme to reflect this. |
This ensures that component bindings are available in the $onInit callback of the component's lifecycle This addresses the main issue brought up by dwmkerr#270
When I pass a component with bindings to the
ModalService.showModal()
function, I would expect to have the passed values available in the$onInit()
lifecycle-hook of that component (that's when all the bindings are supposed to have been initialized). However, that is currently not the case and one can observe the value only being set later. A workaround is to use the$onChanges()
lifecylce-hook of the component, but that's not always convenient.Other observations:
close
needs to be bound as a one-way binding (>
) and not an event binding (&
) as I would have expected@
) does not work. Modifying the above example,test
will evaluate to the stringbindings.test
&
) on the component, glancing at the source code I'd imagine that they won't, especially when trying to pass events with data@DougKeller Any ideas on how to address these issues?
The text was updated successfully, but these errors were encountered: