diff --git a/lib/components/Redoc/redoc.ts b/lib/components/Redoc/redoc.ts index dc3907bc..d6840ff0 100644 --- a/lib/components/Redoc/redoc.ts +++ b/lib/components/Redoc/redoc.ts @@ -17,8 +17,9 @@ import { OptionsService, RedocEventsService } from '../../services/index'; }) export class Redoc extends BaseComponent implements AfterViewInit { static appRef: ComponentRef; + static _preOptions: any; - options: any; + public options: any; private element: any; @@ -51,6 +52,8 @@ export class Redoc extends BaseComponent implements AfterViewInit { constructor(specMgr: SpecManager, optionsMgr:OptionsService, elementRef:ElementRef, public events:RedocEventsService) { super(specMgr); + // merge options passed before init + optionsMgr.options = Redoc._preOptions; this.element = elementRef.nativeElement; //parse options (top level component doesn't support inputs) optionsMgr.parseOptions( this.element ); diff --git a/lib/index.ts b/lib/index.ts index dd970565..1ba596e9 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -20,9 +20,9 @@ export function init(specUrl:string, options?) { if (moduleRef) { destroy(); } - // - // optionsService.options = options; - // optionsService.options.specUrl = optionsService.options.specUrl || specUrl; + + Redoc._preOptions = options; + options.specUrl = options.specUrl || specUrl; Redoc.showLoadingAnimation(); return SpecManager.instance().load(specUrl)