I have a details form that should load the details of a record by when selected from the List Form. When the details form loads, it supposed to show the details of the selected record. In my case, it shows the details quite alright but it displays the titled error on the console, causing the application to crash.
HTML (line of error)
<select id="taxTypeId" name="TaxTypeId" [(ngModel)]="tax.taxTypeId" class="form-control" >
<option *ngFor="let tt of taxTypes" value={{tt.id}}>{{tt.name}}</option>
</select>
<label for="taxTypeId" class="form-label">Tax Type</label>
Typescript
import { Component, ViewChild, Injector, Output, EventEmitter, ElementRef, OnInit } from '@angular/core';
import { RouterLink, Router, ActivatedRoute } from '@angular/router';
import { TaxServiceProxy, TaxDto, ListResultDtoOfTaxTypeDto } from '../../../shared/service-proxies/tax-service-proxies';
import { TaxTypeDto } from '../../../shared/service-proxies/taxType-service-proxies';
import { AppComponentBase } from '@shared/app-component-base';
@Component({
selector: 'app-full-edit-tax',
templateUrl: './full-edit-tax.component.html',
styleUrls: ['./full-edit-tax.component.css']
})
export class FullEditTaxComponent extends AppComponentBase implements OnInit {
active: boolean = false;
saving: boolean = false;
tax: TaxDto;
taxTypes: TaxTypeDto[] = [];
@Output() fromSave: EventEmitter<any> = new EventEmitter<any>();
constructor(
_router: Router,
injector: Injector,
private _taxService: TaxServiceProxy,
private route: ActivatedRoute
) {
super(injector);
this.router = _router;
}
ngOnInit() {
this.loadData();
this.getTaxTypes();
}
loadData(): void {
let id = this.route.snapshot.params['id'];
this._taxService.get(id)
.subscribe((result: TaxDto) => {
this.tax = result;
})
}
getTaxTypes(): void {
this._taxService.getTaxTypes()
.subscribe((result: ListResultDtoOfTaxTypeDto) => {
this.taxTypes = result.items;
});
}
}
How do I resolve this please?