-2

I have >2 group radio button. Every group has >2 radio button. How to get value radio checked.

Hoang Duong
  • 328
  • 4
  • 12

1 Answers1

0

This is your HTML side:

   <div class="form-group">
      <label class="radio-inline">
        <input 
          type="radio" 
          name="options" 
          id="option1"
          [(ngModel)]="dataType" value="100">Radio button 1
      </label>
      <label class="radio-inline">
        <input 
            type="radio" 
            name="options" 
            id="option2"
            [(ngModel)]="dataType" 
            value="99">Radio button 2
       </label>
    </div>

And this one is your .ts component (.ts) side, just declare is as default value.

  public dataType: string = "100"; //Value as default (for selected one)
kboul
  • 13,836
  • 5
  • 42
  • 53
rcanpahali
  • 2,565
  • 2
  • 21
  • 37