Adding Swagger Interface to Angular App

Is there a good way to add Swagger UI to an Angular app without too many weeds?

I would like to add a link to an API hosted on another site, so all I need are interface elements to link to documents.

I found a package called Swangular-Components but it looks like it messed up my index.d.ts file. I think that such a solution would be the easiest for my situation.

+3


source to share


1 answer


This is already 8 months old, so I assume you figured this out or moved on, but it is possible to do it in a basic, if not ideal, way of using Renderer2. Basically you create a script element containing the configuration for swagger-ui and a link to an external document, and then use Renderer2 to add the tag to your component. I am using this now as a way to embed swagger-ui into angular app that allows the user to choose between different api docs.



+1


source







All Articles