How do I convert attrs.requireItems
to a boolean?
attrs.$observe("requireItems", function(){
var val = attrs.requireItems;
ngModel.$setValidity("require-items", !!val);
});
The possible values are all strings but can be "true" "false" "0" or "N" (where N is the length of an array).
The problem is when its "0"
or "false"
it returns true because its a string.