akveo / akveo/nebular

Bad toast notification placement

オープン
#2,281 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
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 はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。