As I work on transferring data from one Angular component to another, everything seems fine in terms of displaying the data until I attempt to edit or update it. Despite adjusting functions, the issue persists, indicating a potential problem with my data binding.
<pre>{{tasklist | json}}</pre> >> //file that is coming from the service
// this is showing properly
<form (ngSubmit) = "updateTask(tasklist)">
<mat-form-field>
<mat-select placeholder="Choose Project" name="projectlist">
<mat-option value="{{prjlist.projectname}}" *ngFor="let prjlist of prjlist">{{prjlist.projectname}}</mat-option>
</mat-select>
</mat-form-field>
...
[Content truncated for brevity]
export class TaskEditComponent implements OnInit {
//hold services
tasklist='';
constructor(//import all services here so that it can show the data in the component of add task
private taskServices: TaskService,
private objsServices : ObjectivesService,
...
this.editServices.sharetask.subscribe(x => this.tasklist = x)
}
updateTask(tasklist:taskdb){
this.taskServices.updateTask(tasklist);
}
}
updateTask(tasks:taskdb){
this.taskDoc = this.tasklist.doc(`tasks/${tasks.id}`);
this.taskDoc.update(tasks);
}