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.

3
  • 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? Commented Jun 13, 2023 at 19:20
  • Because the Web Api will return different angular route that I want to show dinamically. Commented Jun 13, 2023 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. Commented Jun 13, 2023 at 21:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.