May I know how to set css class to div? I tried as below, but fail, and it works if I set style=“color:red” in the div elements.
html code:
<div style="color:red" *ngIf="form.controls.email.hasError('required') && loginForm.controls.email.touched">* Email is required!</div> <div class="alertmsg" *ngIf="form.controls.email.hasError('invalidEmailAddress') && form.controls.email.touched">* Invalid Email Address!</div>
scss:
.test {
alertmsg {
color: red;
}
}
Result: