2
<div class="btn-group" ngbRadioGroup name="radioBasic"[(ngModel)]="model">
    <label ngbButtonLabel class="btn-primary">
        <input ngbButton type="radio"  (click)="event1()" /> Birthday
    </label>
    <label ngbButtonLabel class="btn-primary">
        <input ngbButton type="radio"  (click)="event2()" /> Birthday & Anniversary
    </label>
    <label ngbButtonLabel class="btn-primary">
        <input ngbButton type="radio"  (click)="event3()"/> Anniversary
    </label>
</div>

In the above code the click is not able to load my function , I also tried with (ngModelChange) and (change) they are also not working

prograde
  • 2,620
  • 2
  • 23
  • 32
Saurabh Deshmukh
  • 163
  • 1
  • 15

1 Answers1

3

When you ask Bootstrap to display the radio input as a button, it puts the label over the top of the input button. Because the input tag is behind the label the click can never get to it. You need to catch the click event on the label instead.

<label ngbButtonLabel (click)="event1()" class="btn-primary">
    <input ngbButton type="radio" /> Birthday
</label>
prograde
  • 2,620
  • 2
  • 23
  • 32