Updated to angular 11

Now compiling with strict mode in typescript
Need to error checking now
This commit is contained in:
2020-11-22 10:13:37 +05:30
parent cabd6f2ea1
commit 6567f560ab
187 changed files with 1709 additions and 1184 deletions

View File

@ -11,9 +11,9 @@ import { DiscountDataSource } from './discount-datasource';
styleUrls: ['./discount.component.css'],
})
export class DiscountComponent {
list: any[];
list: any[] = [];
form: FormGroup;
dataSource: DiscountDataSource;
dataSource: DiscountDataSource = new DiscountDataSource([]);
displayedColumns = ['name', 'discount'];
@ -22,7 +22,9 @@ export class DiscountComponent {
private fb: FormBuilder,
@Inject(MAT_DIALOG_DATA) public data: Observable<any[]>,
) {
this.createForm();
this.form = this.fb.group({
discounts: '',
});
this.data.subscribe((list: any[]) => {
this.list = list;
this.form.setControl(
@ -40,12 +42,6 @@ export class DiscountComponent {
});
}
createForm() {
this.form = this.fb.group({
discounts: '',
});
}
accept(): void {
const array = this.form.get('discounts') as FormArray;
this.list.forEach((item, index) => {