export class DashboardComponent implements OnInit {
@ViewChild('modal') modal: ModalComponent;
dashboards: IDashboard[];
dashboard: IDashboard;
constructor(private fb: FormBuilder, private _dshboardService: DashboardService, private router: Router) {
var sesssion = sessionStorage.getItem('EmpDetail');
var ses = JSON.parse(sesssion);
var EmpNo = ses[0].EmpNumber;
var CompanyCode = ses[0].CompanyCode;
this.dashboard = {};
this.dashboard.EmpName = ses[0].EmpName;
this.dashboard.EmpNumber = ses[0].EmpNumber;
}
}
this shows the below error on the line this.dashboard = {};
Error TS2322 Type '{}' is not assignable to type 'IDashboard'.
Property 'EmpName' is missing in type '{}'.
I need to assign the value to the properties of dashboard model and bind the same in html component
Below is my IDashboard:
export interface IDashboard {
EmpName: string,
EmpNumber: string,
EmailId: string,
FirstName: string,
LastName: string,
Gender: string,
Program:string
}
IDashboardclass?IDashboardclass. Check it now