I have main component employees under this there are two components. a) employee b)employee-list the left side part is employee and right side part is employee-list
how can i update employee-list details array after insert in left side without page load in angular 5. Please click on the link in description to see the image for better understand my problem.
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
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.