Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Issues
  • #14377
Closed
Open
Issue created Aug 12, 2014 by Administrator@rootContributor

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

Assignee
Assign to
Time tracking