My dilemma involves an input field for which I need to conditionally apply a CSS class.
For instance, if firstName == undefined
, I want to apply the CSS class ng-dirty
. To achieve this, I attempted:
<input required [(ngModel)]="customer.firstName" name="firstName"
type="text" minlength="2" maxlength="50" ng-class="{ng-dirty : customer.firstName === undefined}">
Despite my efforts, this approach did not produce the desired outcome.