I was messing around with forms and tried the following:
<form (ngSubmit)="login()" #loginForm="ngForm">
<div class="form-group" [class.has-error]="!usernameInput.valid">
<input type="text" class="form-control" ngControl="usernameInput"
[(ngModel)]="username" required #usernameInput="ngForm" />
/div>
</div>
So the "has-error" class should only be applied if the usernameInput is not
valid. Unfortunately using [class.whatever] on a form-group div results in
the error:
EXCEPTION: No provider for ControlContainer! (NgControlName ->
ControlContainer)
If I remove [class.has-error]="!usernameInput.valid" from the div, the
error is gone. Is this a bug?
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.