I have the following angular code:
<div ng-repeat="creation in creations">
<input type="checkbox" data-foobar="[[creation.foobar]]" [[creation.params]]>
[[creation.params]]
</div>
That's it, the problem is that creation.params
contains "disabled checked" or "checked" values, and it should create disabled checkboxes, but it does not. I don't know why, all checkboxes are unchecked.
Even though when I later display creation.params
variable, it shows correct value:
disabled checked
disabled checked
disabled checked
checked
disabled checked
for 5 checkboxes - but all are unchecked.
What's wrong?
By the way, I have used:
$interpolateProvider.startSymbol('[[').endSymbol(']]');
Easiest way to do that would be using ngChecked .
If yo uwant to have more control check official documentation and model your problem as described, it will work. Use ng-model
together with ng-true-value
and ng-false-value
.
Edit:
function isChecked(param) {
return param === 'checked';
}
or directly in template:
ng-checked="creation.params === 'checked'"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.