I always get an error like title this comment. Here is my class CreateChildComponent:
@Input('father') father: Father = new Father();
child: Child = new Child();
submitted = false;
childList: Array<Child> = [];
family: Family = new Family();
constructor(private familyService: FamilyService) {
}
ngOnInit() {
}
createFamily() {
this.family.father = new Father();
this.family.father = this.father;
this.father.family = this.family;
this.family.childList = new Array<Child>();
this.family.childList = this.childList;
this.familyService.createFamily(cache).subscribe(data => console.log(data), error => console.log(error));
// this.familyService.createFamily(this.family)
// // .subscribe(data => console.log(data), error => console.log(error));
this.family = new Family();
}
addChildToList() {
this.child.family = this.family;
this.father.family = this.family;
this.childList.push(this.child);
}
}
I also tried resolve this problem but don't know how. I want to send family object to database. This is my first steps in typescript. Thanks for your help.