Skip to content
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

BodyOutputType.Component with template bindings not working #71

Closed
sprell opened this issue Oct 12, 2016 · 1 comment
Closed

BodyOutputType.Component with template bindings not working #71

sprell opened this issue Oct 12, 2016 · 1 comment
Labels

Comments

@sprell
Copy link

sprell commented Oct 12, 2016

Is there a working demo using BodyOutputType.Component with template bindings? Whenever I try to add bindings or interpolation to the template I get the following error.

Error: Expression has changed after it was checked. Previous value: 'CD_INIT_VALUE'. Current value: 'Some value loaded via component'. It seems like the view has been created after its parent and its children have been dirty checked. Has it been created in a change detection hook ?

I have a modified version of your plunker demonstrating this issue here...
http://plnkr.co/edit/d8xggIUEQxtwzNrANlZh

If you remove the "{{someValue}}" from the template, it will work fine. Any idea what might be wrong here? This used to work with versions prior to the official Angular2 release.

Thanks.

@Stabzs
Copy link
Owner

Stabzs commented Oct 12, 2016

Thanks for the modified plunker.

This looks like this is caused by changes made post rc.5 that do not allow new model changes in ngAfterViewInit(), which is the hook used for dynamic rendering since it is not until that point that the new componentFactoryResolver can render the component.

This should be as simple as forcing change detection within the lifecycle hook. This was not properly covered by tests and as a result never showed up.

Thanks for bringing this up. This will be fixed soon.

@Stabzs Stabzs added the bug label Oct 12, 2016
@Stabzs Stabzs closed this as completed in 0ce7e1c Oct 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants