javascript - FadeIn Animation to Validations- Angular -
i want add fade-in transition validation labels in angular-
<form [formgroup]="regform"> <div formgroupname="teamdetails"> <div class="form-group"> <label for="teamname">team name:</label> <label class="validations" *ngif="!regform.get('teamdetails.teamname').valid && regform.get('teamdetails.teamname').touched">please enter valid team name!</label> <input type="text" class="form-control" formcontrolname="teamname" id="teamname" required placeholder="enter team name"> </div>
i want them appear opacity transition, tried $('label').fadein(2000);
in jquery didn't work.
add animation component decorator:
animations:[ trigger('load', [ transition(':enter', [ style({ opacity: 0 }), animate(600, style({ opacity: 1 })) ]), transition(':leave', [ style({ opacity: 1 }), animate(600, style({ opacity: 0 })) ]) ]) ]
andand in view :
<label @load style="color:red" *ngif="mymodel.invalid">invalid</label>
don't forget add module:
import { browseranimationsmodule } '@angular/platform-browser/animations';
....
imports: [ ...., browseranimationsmodule ],
Comments
Post a Comment