New King
New King

Reputation: 21

How to use radio button in AngularJS 2?

I am sorry to say that I failed to find a radio button example in the AngularJS 2 FORMS documentation. Please give a live example. Thanks.

Upvotes: 0

Views: 276

Answers (1)

Zilong Wang
Zilong Wang

Reputation: 584

Please try those code:

Html

<form>
    <input type="radio" [checked]="radioValue" (click)="clickRadio()"/>
</form>
radio value: {{radioValue}}

ts

radioValue:boolean = false;
clickRadio(){
  this.radioValue = !this.radioValue
}

Upvotes: 1

Related Questions