我爲我的FormGroup創建了一個Angular動畫,以便不同的Form部分按順序顯示動畫。這裏是代碼 -Angular 4 Animation not working
animations:[
trigger('visibilityChanged', [
state('shown' , style({ opacity: 1 })),
state('hidden', style({ opacity: 0 })),
transition('shown => hidden', animate('600ms')),
transition('void => *', animate('1000ms')),
])
]
這裏是HTML的
<form [formGroup]="regForm">
<div *ngIf="showcontrol[0]" @visibilityChanged>
<span id="formheading" class="text-center">ENTER TEAM DETAILS</span>
<div class="form-group">
<label for="teamname">Team Name:</label>
<label class="validations" @load *ngIf="!regForm.get('team_name').valid && regForm.get('team_name').touched">Please Enter a Valid Team Name!</label>
<input type="text" class="form-control" formControlName="team_name" id="teamname" required placeholder="Enter Your Team Name">
</div>
....... ..
你能解釋一點點嗎?哪些部分?我認爲除上述之外還有其他部分? – Vega
我有一個FormGroup,像上面那樣有ngIf的分區,有一個按鈕將showcontrol [i + 1]設置爲true(並將showcontrol [i]設置爲false,以便下一個表單組變爲可見,後一個隱藏 –