This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Description
This may be by design, but I thought I'd bring it up.
Since ngAttr-prefixed attributes are interpolated with allOrNothing, an attribute may or may not be present initially. If the expression is defined on the first evaluation, it looks like the resulting attribute will trigger directives. However, if the expression is initially undefined, when it later becomes defined the attribute that is added will not cause any directives to be applied to the element.
My use case is this: I'm using ng-attr-min and ng-attr-max on an input[type=date] with something like ng-attr-min="{{minDate | date:'yyyy-MM-dd'}}". If minDate is undefined, I don't want there to be any min validation. When minDate becomes defined, the min attribute is properly set but the min directive is not applied retroactively, therefore I don't get my angular min validation.
The alternatives are
- Use
ngMin, but this doesn't set the min attribute and on Chrome the datepicker won't be properly restricted.
- Use interpolation on
min directly (e.g. min="{{minDate | date:'yyyy-MM-dd'}}"), but when minDate is undefined, this leaves a dangling min attribute with no value which incorrectly makes any value invalid (this might be a bug).