Я использую данный метод для помещения элементов в массив с именем Edudata.когда данные передаются, моя логическая переменная с именем isSuccessful становится истинной
когда данные передаются, моя логическая переменная с именем isSuccessful становится истинной.На стороне клиента я проверил в состоянии ngif, если выдаваемый результат - истина, таблица генерирует
saveEducation(educ: Education) {
this.eduData.push(educ);
this.isSuccessful = true;
}
<table class="table-responsive" *ngIf="isSuccessful">
<button mat-raised-button color="Primary"
(click)="saveEducationtoTable(education)">Add</button>
<table class="table-responsive" *ngIf="isSuccessful">
<thead>
<tr>
<th>
Degree Name
</th>
<th>
Institute Name
</th>
<th>
Start Date
</th>
<th>
End Date
</th>
<th>
<td class="td-input">
<mat-label class="label-margin">Select Degree</mat-label>
</td>
<td>
<mat-select name="degree" [(ngModel)]="education.degree_Name"
placeholder="--Select Degree--"
required>
<mat-option value="No formal education">No formal
education</mat-option>
<mat-option value="Primary education">Primary education</mat-
option>
<mat-option value="Secondary education">Secondary education or
high school</mat-option>
<mat-option value="Vocational qualification">Vocational
qualification</mat-option>
<mat-option value="Bachelor's degree">Bachelor's degree (14
years)</mat-option>
<mat-option value="Bachelor's degree">Bachelor's degree (16
years)</mat-option>
<mat-option value="Master's degree">Master's degree</mat-option>
<mat-option value="Doctorate or higher">Doctorate or
higher</mat-option>
</mat-select>
</td>
</tr>
</table>
</mat-form-field>
<!-- Choose Start Date For Degree Date Picker -->
<mat-form-field class="inputClass">
<table class="inputClass">
<tr>
<td class="td-input">
<mat-label class="label-margin">Start Date</mat-label>
</td>
<td>
<input matInput [matDatepicker]="pickerStart" name="start_Date"
placeholder="Choose a Start date"
[(ngModel)]="education.start_Date"required disabled>
<mat-datepicker-toggle matSuffix [for]="pickerStart" required>
</mat-
datepicker-toggle>
<mat-datepicker #pickerStart disabled="false" required></mat-
datepicker>
</td>
</tr>
</table>
<!-- Choose End Date For Degree Date Picker -->
</mat-form-field>
<mat-form-field class="inputClass">
<table class="inputClass">
<tr>
<td class="td-input">
<mat-label class="label-margin">End Date</mat-label>
</td>
<td>
<input matInput
[matDatepicker]="pickerEnd"name="start_Date"
placeholder="Choose a End date"[(ngModel)]="education.end_Date"
required
disabled>
<mat-datepicker-toggle matSuffix [for]="pickerEnd"required>
</mat-datepicker-toggle>
<mat-datepicker #pickerEnd disabled="false"required></mat-
datepicker>
</td>
</tr>
</table>
</mat-form-field>
<!-- Select Institute dropdown -->
<mat-form-field class="inputClass">
<table class="inputClass">
<tr>
<td class="td-input">
<mat-label class="label-margin">Select Institution</mat-label>
</td>
<td>
<mat-select name="institution"
[(ngModel)]="education.Institution_Name" placeholder="--Select
Institution--" required>
<mat-option value = "NUST" >NUST</mat-option>
<mat-option value = "IIUI">IIUI</mat-option>
</mat-select>
</td>
</tr>
</table>
</mat-form-field>
Теперь, когда таблица сформирована, я хочу снова сделать isSuccessful ложным.так что когда пользователь вводит данные второй раз в массив, isSuccessful должно становиться true, иначе false