mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-22 16:46:34 +03:00
Propagate external options
This commit is contained in:
parent
50f65f7cfd
commit
27197ffb46
|
@ -17,8 +17,9 @@ import { OptionsService, RedocEventsService } from '../../services/index';
|
|||
})
|
||||
export class Redoc extends BaseComponent implements AfterViewInit {
|
||||
static appRef: ComponentRef<any>;
|
||||
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 );
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user