How to uncheck a radio button on its second click Angular 2+

后端 未结 2 1353
野趣味
野趣味 2021-01-25 05:10

I am trying to implement Radio button uncheck on second click in Angular 2+ as done here in angularjs. I have an array of objects that get displayed using *ngFor, therefore I ha

相关标签:
2条回答
  • 2021-01-25 05:21

    You need to bind the radio value to an ngModel and either listen to the ngModelChange or click event instead of change.

    This answer might help you as well https://stackoverflow.com/a/42447116/4544288

    0 讨论(0)
  • 2021-01-25 05:26

    Please try your code with more radio buttons. Is it works well, you able to try to un-select the selected radio button when you click it again? I means your stackblitz code: stackblitz.com/edit/angular-bootstrap4-jo5acq.

    0 讨论(0)
提交回复
热议问题