Button.prototype.toggle not triggering change event on Angular Model
Created by: ankurp
Angular model doesn't seem to trigger the change event if radio buttons are used with angular model as such.
<div class="btn-group" role="toolbar" data-toggle="buttons">
<label data-ng-class="{active: modelVal=='a'}">
<input type="radio" value="a" data-ng-model="modelVal" name="options">
<span>A</span>
</label>
<label data-ng-class="{active: modelVal=='b'}">
<input type="radio" value="b" data-ng-model="modelVal" name="options">
<span>B</span>
</label>
</div>
<!-- These are not hidden by default but the classes are not set when the Button.prototype.toggle gets called -->
<div data-ng-class="{visible: modelVal=='a'}"></div>
<div data-ng-class="{visible: modelVal=='b'}"></div>
The following line seems to cause the issue. Should it be trigger('click')
instead of trigger('change')
?
https://github.com/twbs/bootstrap/blob/541a75f92c9b9e5b13fe1c331f9d10ba2e12b4de/js/button.js#L62
Also looking at this question the radio input tag value is not changed but the checked property avalue is. http://stackoverflow.com/questions/8838648/onchange-event-handler-for-radio-button-input-type-radio-doesnt-work-as-one