How to assign value to angular material checkbox in angularjs

15,564

My issue was resolved. The problem is when I retrieve the value it was in string format. Before assigning it to the view ng-model, convert the string into boolean.

After coverting to boolean my checkbox works fine.

Updated code

<div ng-repeat="rules in rulesList1.data.hits.hits">
    <md-checkbox md-no-ink aria-label="Checkbox No Ink" id="chkR1" ng-model="_source.Enabled" class=" md-primary">
    </md-checkbox>
</div>
Share:
15,564
Mangoski
Author by

Mangoski

Updated on June 04, 2022

Comments

  • Mangoski
    Mangoski almost 2 years

    I am using the Angular Material checkbox in my application. I am facing problem in assigning the value to a checkbox.

    <div ng-repeat="rules in rulesList1.data.hits.hits">
        <md-checkbox md-no-ink aria-label="Checkbox No Ink" id="chkR1" ng-checked="_source.Enabled" class=" md-primary">
        </md-checkbox>
    </div>
    

    When I use this my checkbox becomes non-editable. I couldn't check or uncheck the box on using the above code. I don't know where I am going wrong.

    Thanks in advance.