Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NzMessageService.remove(id=undefined) in 9.x fails on blank slate #5121

Closed
christarnowski opened this issue Apr 23, 2020 · 0 comments · Fixed by #5123
Closed

NzMessageService.remove(id=undefined) in 9.x fails on blank slate #5121

christarnowski opened this issue Apr 23, 2020 · 0 comments · Fixed by #5123
Assignees

Comments

@christarnowski
Copy link

Versions

NG-ZORRO-ANTD: 9.0.2
Angular: 9.1.3

Description

I've upgraded our Angular app and NG-ZORRO-ANTD to v9. What worked fine before (in 8.5.2), that is calling NzMessageService instance's remove() without an argument when no messages have been created yet, throws this.container is undefined in 9.0.2.

Once at least one Message has been created, the remove() call works fine.

The expected behavior is for remove() to have no effect on a blank slate.

Sample code to reproduce

import {Component} from "@angular/core";
import {NzMessageService} from "ng-zorro-antd/message";

@Component({
  selector: "app-root",
  templateUrl: "./app.component.html",
  styleUrls: ["./app.component.less"]
})
export class AppComponent implements OnInit {
  title = "It's over Anakin, I have the high ground!";

  constructor(private message: NzMessageService) {}

  ngOnInit(): void {
    this.message.remove(); // throws "this.container is undefined" in "this.container.removeAll()" code path
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants