I have an issue with my Angular toDoApp project. I have 3 components (app,task-form.task-list). App component receives the final logic from other components. But when I try to push the final object into array, it says that the object values are undefined.
export interface toDoInterface {
tittle: string,
description:string;
}
----------
export class AppComponent {
toDoList = []; //**It returns undefined value**
newToDo (formData: toDoInterface) {
this.toDoList.push({
tittle: formData.tittle,
description: formData.description
});
}
}
----------
export class TaskFormComponent implements OnInit {
@Output() toDo = new EventEmitter<{newTittleValue: string, newDescValue:string}>();
tittleValue = '';
descValue = '';
constructor() { }
ngOnInit() {
}
addToList () {
this.toDo.emit({newTittleValue:this.tittleValue,newDescValue:this.descValue})
}
}
----------
export class TaskListComponent implements OnInit {
@Input() name: toDoInterface;
constructor() { }
ngOnInit() {
}
}
$eventresponse param correctly?? angular.io/api/core/EventEmitter