Bad toast notification placement
- 主要言語
- TypeScript
- スター
- 8.1k
- フォーク
- 1.5k
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
### Issue type
**I'm submitting a ...** (check one with "x")
* [X] bug report
* [ ] feature request
### Issue description
**Current behavior:**
Calling NbToastrService from a GlobalErrorHandler to build a toast notification (NbToastrModule is configured in app.module to show in TOP_RIGHT position), but shows in TOP_LEFT on first toast notif. The second one is displayed correctly
**Expected behavior:**
Should display toast notification in specified position.
**Steps to reproduce:**
**Related code:**
```
@Injectable()
export class GlobalErrorHandler implements ErrorHandler {
constructor(
private toastrService: NbToastrService
) {
}
getClientErrorMessage(error: Error): string {
return error.message ?
error.message :
error.toString();
}
getServerErrorMessage(error: HttpErrorResponse): string {
if (navigator.onLine) {
return error.error ? error.error[0].message : error.message;
}
return 'No Internet Connection';
}
handleError(error: Error | HttpErrorResponse) {
let message;
if (error instanceof HttpErrorResponse) {
// Server error
message = this.getServerErrorMessage(error);
} else {
// Client Error
message = this.getClientErrorMessage(error);
}
this.toastrService.danger(message, 'Error', {position: NbGlobalPhysicalPosition.TOP_RIGHT});
console.error(error);
}
}
```
### Other information:
**npm, node, OS, Browser**
```
```
**Angular, Nebular**
```
"@angular/core": "~9.0.5"
"@nebular/theme": "4.6.0"
```
コントリビューションガイド
評価
この issue はまだ評価されていません。