Issue
I have a 2 components add-items and view-items. view-items is my parent component and add-item is my child component.
In view-items component i have table and its data. There is a Edit button in my each row. So, when user clicks on edit button. i am sending that row values to add-items component. but, i am unable to set those values in form and unable to update in table with specified row. can anyone help me here?
Thanks in advance!
Solution
You have to implement ngOnChanges
and copy all properties to StudentFormData
.
export class AddItemsComponent implements OnInit, OnChanges{
:
ngOnChanges(changes: SimpleChanges): void {
this.StudentFormData.name = this.item.name;
this.StudentFormData.division = this.item.division;
this.StudentFormData.gender = this.item.gender;
}
}
Answered By - N.F.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.