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.

Checkbox Input bind not working properly #1911

Closed
@raftalks

Description

@raftalks

Hi,

I am using a checkbox bind to json object where the value is numeric 1 or 0. Angularjs doesn't seem to work properly if the value of the model is numeric.

See this plunkr below and note that "value2" model obj given numeric value 1 and having the checkbox field with ng-true-value='1' doesn't make the checkbox checked.

With observation, I have noticed angular ng-true-value is actually doing '1' === 1 to model numeric value and returns false, this can work if it compares with == only. This is define in the line here I think: https://github.com/angular/angular.js/blob/master/src/ng/directive/input.js#L646

Plunkr: http://plnkr.co/edit/cBBj54NKQ0OZXSZCQkdd?p=preview

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions