Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To disable a radio button in Angular 5, you can use the disabled attribute. Here's an example:

<input type="radio" name="gender" value="male" [disabled]="isDisabled">

In the above code, the radio button will be disabled if the isDisabled variable is set to true. You can set this variable in your component code.

Alternatively, you can use a FormControl to disable the radio button:

this.myForm = new FormGroup({
  'gender': new FormControl({value: 'male', disabled: true})
});

In this code, the FormControl is initialized with the disabled property set to true, which will disable the corresponding radio button.