kulbhushan charaya
kulbhushan charaya

Reputation: 119

uncheck default assign checked value in checkbox angular material

I am bit new angular and trying to show a check box with it's value checked at page load but when I try to uncheck this checkbox after page load then it is not allowing me to do so. I am using angular material in this task.

Following is my current code.

<md-checkbox aria-label="Checkbox 1" class="green"  ng-checked="true">
</md-checkbox>

Upvotes: 1

Views: 1779

Answers (1)

Deep
Deep

Reputation: 9794

As per angular documentation the ng-checked value should be an expression which can hold both the true and false value. In your code your have assigned this a direct true value that is why it is not working as expected.

check the below plunker

https://plnkr.co/edit/6zGl5E2mEN0JvGSF4159?p=preview

<md-checkbox class="green" ng-checked="master" ng-click="master=!master">
Checkbox

Upvotes: 1

Related Questions