0

I am using Angular 6 in my application. After calling a Web Api I compose an Angular route Url, for example /module-name/component-name/par1Value/par2Value/par3Value.

I now want to show the component from the read route in a Material Dialog.

How can I accomplish it? Can I create the component from the Url, so that I can pass it to open method?

this.dialog.open(myCreatedComponent,
          {
            width: '900px',
            height: '600px'
          });

Or is there another way?

Thanks in advance.

ExpRick
  • 13
  • 2
  • The question is: Why do you want it as dynamic component? What exactly is your goal? Does the normal router-outlet not fit for you? – Daniel Michelfelder Jun 13 '23 at 19:20
  • Because the Web Api will return different angular route that I want to show dinamically. – ExpRick Jun 13 '23 at 20:02
  • As long as you know which component to render for each possible route that is returned from the web api, and you have those routes setup, I would use the `Router` service by injecting it into the code where you are handling the http call and once you have the url, use `this.router.navigate([path]);` But I noticed that you are trying to open it in a dialog. This can be more difficult, but essentially you would want to map the possible paths you get back from the web api to the components you want to render. – Jake Smith Jun 13 '23 at 21:05

0 Answers0