How do I integrate Swagger into my UI? Here's what I tried:
import * as SwaggerUI from 'swagger-ui';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {
constructor(private el: ElementRef) {
const swaggerUi = new SwaggerUI({
url: 'http://petstore.swagger.io/v2/swagger.json',
domNode: this.el.nativeElement.querySelector('.swagger-container'),
deepLinking: true,
presets: [
SwaggerUI.presets.apis
],
});
swaggerUi.load();
}
Error: swaggerUi.load is not a function. I'm struggling to display my yaml/json in an angular application. Any help would be appreciated. Thanks!