I do have a directive input-checkbox as a template for <input type="checkbox" .... I am trying to pass values for ng-true-value to this directive and here I am stuck:
I am using the directive like this:
<input-checkbox ... mv-true-value="false" mv-false-value="true" mv-disabled="true"></input-checkbox>
and the directive template looks like this:
<input type="checkbox" ...
ng-disabled="mvDisabled"
ng-true-value="mvTrueValue"
ng-false-value="mvFalseValue">
The value für ng-disabled is correctly compiled as "true" but ng-true-value and ng-false-value are not correctly set.
To narrow down what might be wrong i tried different stuff: This works as aspected:
<input type="checkbox" ...
ng-disabled="mvDisabled"
ng-true-value="false"
ng-false-value="true">
Also this works as aspected:
<input type="checkbox" ...
ng-disabled="mvFalseValue"
ng-true-value="false"
ng-false-value="true">
WebStorm tells me ng-true-value is not allowed here but as described above it still works if I set fixed values in the template file. I am working with AngularJS 1.7.2
Any ideas?
EDIT: I forgot this information. The scope in my .js for the directive looks like this:
scope: {
...
mvDisabled: "=",
mvTrueValue: "=",
mvFalseValue: "=",
...
}
ng-true-valueonly accepts constant expressions. docs.angularjs.org/error/ngModel/constexprng-true-value="'potatoes'"Notice the single and double quotes.