繁体   English   中英

uncheck default assign checked value in checkbox angular material

[英]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>

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM