Skip to content

Radio button works incorrectly when patch from value #9801

Closed Answered by waterplea
vytautas-pranskunas- asked this question in Q&A
Discussion options

You must be logged in to vote

In your stackblitz when I add markForCheck it fixes the issue. As it is it is working as expected, without notifying Angular change detection while doing async operations in OnPush all sorts of different issues might pop up — this is not the correct usage.

It works part-way because Angular imperatively updates state of the checkbox without notifying change detection, so styles that depend on CSS :checked are applied, but some other things rely on bindings that are not updated because nothing has notified the view that change detection must be ran.

In other words, either use default change detection strategy, or use OnPush properly. If your state management calls markForCheck it must be ca…

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@waterplea
Comment options

@vytautas-pranskunas-
Comment options

@vytautas-pranskunas-
Comment options

@waterplea
Comment options

Answer selected by vytautas-pranskunas-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants