Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

ng-model doesn't work with check box in 1.4.7 version #13464

Closed
@tosandeepgarg

Description

@tosandeepgarg

Hi

i have below code which works fine with 1.2.19 but doesn't work with 1.4.7. Let me know if something i have missed.

    <div ng-repeat="sport in ctrl.sports">
        <label ng-bind="sport.label"></label>
        <div>
            With Binding:
            <input type="checkbox"
                   ng-model="sport.selected"
                   ng-true-value="YES"
                   ng-false-value="NO">
        </div>
        <div>
            Using ng-checked:
            <input type="checkbox"
                   ng-checked="sport.selected === 'YES'">
        </div>
        <div>
            Current state: {{sport.selected}}
        </div>
    </div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js">
</script>
<script type="text/javascript">
    angular.module('notesApp', [])
    .controller('MainCtrl', [function () {
        var self = this;
        self.sports = [
        { label: 'Basketball', selected: 'YES' },
        { label: 'Cricket', selected: 'NO' },
        { label: 'Soccer', selected: 'NO' },
        { label: 'Swimming', selected: 'YES' }
        ];
    }]);
</script>

Regards,
Sandeep

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions