diff --git a/lib/components/ApiInfo/api-info.spec.ts b/lib/components/ApiInfo/api-info.spec.ts index 7f5bf1c8..4d0e6612 100644 --- a/lib/components/ApiInfo/api-info.spec.ts +++ b/lib/components/ApiInfo/api-info.spec.ts @@ -11,7 +11,7 @@ import { } from '@angular/core/testing'; import { ApiInfo } from './api-info'; -import { SpecManager } from '../../utils/SpecManager'; +import { SpecManager } from '../../utils/spec-manager'; describe('Redoc components', () => { describe('ApiInfo Component', () => { diff --git a/lib/components/ApiInfo/api-info.ts b/lib/components/ApiInfo/api-info.ts index 9847210a..00a301c6 100644 --- a/lib/components/ApiInfo/api-info.ts +++ b/lib/components/ApiInfo/api-info.ts @@ -12,7 +12,7 @@ import { OptionsService, MenuService } from '../../services/index'; export class ApiInfo extends BaseComponent implements OnInit { info: any = {}; specUrl: String; - constructor(specMgr:SpecManager, private optionsService:OptionsService, private menuServ: MenuService) { + constructor(specMgr:SpecManager, private optionsService: OptionsService) { super(specMgr); } diff --git a/lib/components/ApiLogo/api-logo.spec.ts b/lib/components/ApiLogo/api-logo.spec.ts index e4ba00c0..5ef98c1f 100644 --- a/lib/components/ApiLogo/api-logo.spec.ts +++ b/lib/components/ApiLogo/api-logo.spec.ts @@ -10,7 +10,7 @@ import { } from '@angular/core/testing'; import { ApiLogo } from './api-logo'; -import { SpecManager } from '../../utils/SpecManager'; +import { SpecManager } from '../../utils/spec-manager'; describe('Redoc components', () => { diff --git a/lib/components/JsonSchema/json-schema-lazy.ts b/lib/components/JsonSchema/json-schema-lazy.ts index 80dc3f63..4cfe9143 100644 --- a/lib/components/JsonSchema/json-schema-lazy.ts +++ b/lib/components/JsonSchema/json-schema-lazy.ts @@ -5,7 +5,7 @@ import { Component, ElementRef, ViewContainerRef, OnDestroy, Input, import { JsonSchema } from './json-schema'; import { OptionsService } from '../../services/options.service'; -import { SpecManager } from '../../utils/SpecManager'; +import { SpecManager } from '../../utils/spec-manager'; var cache = {}; @@ -38,7 +38,7 @@ export class JsonSchemaLazy implements OnDestroy, AfterViewInit { var componentFactory = this.resolver.resolveComponentFactory(JsonSchema); let contextInjector = this.location.parentInjector; let compRef = this.location.createComponent(componentFactory, null, contextInjector, null); - this.initComponent(compRef.instance); + this.projectComponentInputs(compRef.instance); this._renderer.setElementAttribute(compRef.location.nativeElement, 'class', this.location.element.nativeElement.className); compRef.changeDetectorRef.detectChanges(); this.loaded = true; @@ -58,24 +58,22 @@ export class JsonSchemaLazy implements OnDestroy, AfterViewInit { this.pointer = this.normalizePointer(); if (cache[this.pointer]) { let compRef = cache[this.pointer]; - setTimeout( ()=> { - let $element = compRef.location.nativeElement; + let $element = compRef.location.nativeElement; - // skip caching view with descendant schemas - // as it needs attached controller - if (!this.disableLazy && (compRef.instance.hasDescendants || compRef.instance._hasSubSchemas)) { - this._loadAfterSelf(); - return; - } - insertAfter($element.cloneNode(true), this.elementRef.nativeElement); - this.loaded = true; - }); + // skip caching view with descendant schemas + // as it needs attached controller + if (!this.disableLazy && (compRef.instance.hasDescendants || compRef.instance._hasSubSchemas)) { + this._loadAfterSelf(); + return; + } + insertAfter($element.cloneNode(true), this.elementRef.nativeElement); + this.loaded = true; } else { cache[this.pointer] = this._loadAfterSelf(); } } - initComponent(instance:JsonSchema) { + projectComponentInputs(instance:JsonSchema) { Object.assign(instance, this); } diff --git a/lib/components/JsonSchema/json-schema.spec.ts b/lib/components/JsonSchema/json-schema.spec.ts index d2c8f697..53b77cad 100644 --- a/lib/components/JsonSchema/json-schema.spec.ts +++ b/lib/components/JsonSchema/json-schema.spec.ts @@ -10,7 +10,7 @@ import { getChildDebugElement } from '../../../tests/helpers'; import { JsonSchema } from './json-schema'; -import { SpecManager } from '../../utils/SpecManager';; +import { SpecManager } from '../../utils/spec-manager';; describe('Redoc components', () => { beforeEach(() => { diff --git a/lib/components/Method/method.spec.ts b/lib/components/Method/method.spec.ts index c5e80d15..c35508a0 100644 --- a/lib/components/Method/method.spec.ts +++ b/lib/components/Method/method.spec.ts @@ -10,7 +10,7 @@ import { import { getChildDebugElement } from '../../../tests/helpers'; import { Method } from './method'; -import { SpecManager } from '../../utils/SpecManager';; +import { SpecManager } from '../../utils/spec-manager';; describe('Redoc components', () => { beforeEach(() => { diff --git a/lib/components/MethodsList/methods-list.spec.ts b/lib/components/MethodsList/methods-list.spec.ts index e552d2d2..ca59e157 100644 --- a/lib/components/MethodsList/methods-list.spec.ts +++ b/lib/components/MethodsList/methods-list.spec.ts @@ -11,7 +11,7 @@ import { getChildDebugElement } from '../../../tests/helpers'; import { MethodsList } from './methods-list'; -import { SpecManager } from '../../utils/SpecManager'; +import { SpecManager } from '../../utils/spec-manager'; describe('Redoc components', () => { beforeEach(() => { diff --git a/lib/components/Redoc/redoc.html b/lib/components/Redoc/redoc.html index 8df000b0..11e8c3d7 100644 --- a/lib/components/Redoc/redoc.html +++ b/lib/components/Redoc/redoc.html @@ -1,4 +1,8 @@ -