akveo / akveo/nebular

[TOASTR] ViewDestroyedError: Attempt to use a destroyed view: detectChanges

Đang mở
#2,429 1 bình luận 0 reaction 1 người được giao Được @evtkhvch nhận Xem trên GitHub
needs info
Ngôn ngữ chính
TypeScript
Star
8.1k
Fork
1.5k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### Issue type

**I'm submitting a ...** (check one with "x")

* [x] bug report
* [ ] feature request

### Issue description

**Current behavior:**

When using the toastr, the first click of a button triggering the toastr works fine, however the second, and subsequent clicks generate a ViewDestroyedError. The Toastr itself still renders but the following error also displays in the console:

button.component.html:4 ERROR Error: ViewDestroyedError: Attempt to use a destroyed view: detectChanges
at viewDestroyedError (core.js:19641)
at Object.debugUpdateDirectives [as updateDirectives] (core.js:30040)
at checkAndUpdateView (core.js:29439)
at callWithDebugContext (core.js:30309)
at Object.debugCheckAndUpdateView [as checkAndUpdateView] (core.js:30011)
at ViewRef_.push../node_modules/@angular/core/fesm5/core.js.ViewRef_.detectChanges (core.js:20686)
at patch (index.js:1874)
at NbToastContainer.push../node_modules/@nebular/theme/fesm5/index.js.NbToastContainer.updateContainer (index.js:19154)
at NbToastContainer.push../node_modules/@nebular/theme/fesm5/index.js.NbToastContainer.destroy (index.js:19102)
at index.js:19147

**Expected behavior:**

The toastr should be able to be clicked multiple times and destroy correctly without the error.

**Steps to reproduce:**

Set up a button trigger that on click calls the simple showToast function from the documentation. Look in the devTools on chrome and the error should show up.

**Related code:**

```
insert short code snippets here
```
My code is set up like this:
Component.ts
` showToast() {
this.index ++;
const duration = 2000;
let status = this.toaststatus;
let position = this.position;
this.toastrService.show(
this.message,
this.title || 'Title',
{ position, status, duration });
}`

html
`{{label}}`

### Other information:

**npm, node, OS, Browser**
```

```

**Angular, Nebular**
```
Nebular version: '4.6.0', Angular version: 8.2
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.