Search code examples
javascriptangularweb-componentng-zorro-antd

NzModal content is not display and without error


I have a web component who have a method who, in case of error, call an other component to display an error.

When I call the web component the error modal is display correctly. But when I try to call directly the method, the modal is display without the content on the top left of the page.

enter image description here

I try to call the method to provide a js api. For that, I have create a service with the methods I want to call, and in my app module I pass the service to a window variable so I can call the method after it minify

window['test'] = this.testService.test;

the method in my service:

this.test = {
  getTest(
      uri: string,
      headers: {[p: string]: string | string[]},
      queryParams: {[p: string]: string | string[]},
      successCallback: () => void
  ): void {
    nzModalService.error({nzTitle: 'title'});
  },
}

I guess it is an injection issue but I cant find a solution, thank in advance


Solution

  • <ng-container *nzModalContent>
        <app-example-component></app-example-component>
    </ng-container>
    

    Wrap the content with ng-container