在此之下,我有主要组成部分员工,有两个组成部分。 a)员工b)员工名单 the left side part is employee and right side part is employee-list
在左侧插入后如何在角度5中没有页面加载的情况下如何更新员工列表详细信息数组? 请单击描述中的链接以查看图像,以更好地了解我的问题。
答案 0 :(得分:1)
child component 1 // employee component
@Output()
employeeListDetails = new EventEmitter(); // emit your submitted details array
Main component: // parent component
@Input()
employeeListDetails: any; // this is the array of your submitted data in employee component
Parent HTML:
<app-employee (employeeListDetails)="employeeListDetails= $event"> </app-employee>
<app-employee-list [employeeData] = "employeeListDetails"> </app-employee-list>
child component 2 // employee list component
@Input()
employeeData: any;
ngOnChanges(simpleChanges: SimpleChanges) { // you have to import OnChange and SimpleChanges
if (employeeData !== undefined){
// assign employee data to the variable you are iterating
}
}