Skip to content

ExpressionChangedAfterItHasBeenCheckedError when changing a component 'non model' value in afterViewInit #15464

@adrienboulle

Description

@adrienboulle

I'm submitting a ...

[x] bug report
[ ] feature request
[ ] support request

Current behavior
changing a component 'non model' value in afterViewInit throws ExpressionChangedAfterItHasBeenCheckedError if the value has an impact on a method used in the view.

in the plunker:
-> getTextDecoration() returns none before ngAfterViewInit is called (isViewInit === false)
-> getTextDecoration() returns underline after ngAfterViewInit is called (isViewInit === true)

Expected behavior
it should not throw the error since getTextDecoration is just a method and not part of the model.

Minimal reproduction of the problem with instructions
http://plnkr.co/edit/k8AsppUH8V2RvPeLJ0JT?p=preview

  • Angular version: 4.0.0 => KO
  • Angular version: 4.0.0-beta.8 => OK

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreIssues related to the framework runtimeregressionIndicates than the issue relates to something that worked in a previous versiontype: bug/fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions