In my Angular project I want to emit inside the .then and .catch, but they do net get called. Everything else inside the .then and .catch does get called.
When I emit outside the promise it does work.
This is my code
updateAssignee(newAssignee: string) {
this.storyService.updateAssignee(this.story, newAssignee).then(res =>{
console.log('test') //This one gets called
this.onError.emit({ //This one does not get called
error: false,
errorText: ''
});
}).catch((error) => {
console.log('test') //This one gets called
this.onError.emit({ //This one does not get called
error: true,
errorText: '• ' + error.message
});
});
this.onError.emit({ //This one gets called
error: false,
errorText: '• Missing permissions'
});
}
Is it not possible to emit inside the .then and .catch? Or am I missing something?
The way these components are loaded is via a ngFor loop. Maybe this causes some problems?
<span *ngFor="let story of done">
<app-storyboard-story (onError)="throwError($event)" [story]="story" [project]="project" cdkDrag></app-storyboard-story>
</span>