Skip to content

Commit

Permalink
* fixed the version-compatibility.directive (#6391)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhrn authored Nov 30, 2020
1 parent e55c255 commit f3e5dfe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions lib/core/directives/version-compatibility.directive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { TranslateModule } from '@ngx-translate/core';
import { TestBed, ComponentFixture } from '@angular/core/testing';
import { setupTestBed } from '../testing/setup-test-bed';
import { CoreTestingModule } from '../testing/core.testing.module';
import { VersionCompatibilityService } from '@alfresco/adf-core';
import { VersionCompatibilityService } from '../services/version-compatibility.service';

@Component({
template: `
Expand Down Expand Up @@ -63,8 +63,7 @@ describe('VersionCompatibilityDirective', () => {
TranslateModule.forRoot(),
CoreTestingModule
],
declarations: [TestComponent
]
declarations: [TestComponent]
});

beforeEach(() => {
Expand Down
6 changes: 3 additions & 3 deletions lib/core/directives/version-compatibility.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import { Directive, Input, ViewContainerRef, TemplateRef } from '@angular/core';
import { VersionCompatibilityService } from '../services/version-compatibility.service';
import { take } from 'rxjs/operators';

@Directive({
selector: '[adf-acs-version]'
Expand All @@ -37,11 +38,10 @@ export class VersionCompatibilityDirective {
}

private validateAcsVersion(requiredVersion: string) {
this.versionCompatibilityService.acsVersionInitialized$.subscribe(() => {
this.versionCompatibilityService.acsVersionInitialized$.pipe(take(1)).subscribe(() => {
this.viewContainer.clear();
if (requiredVersion && this.versionCompatibilityService.isVersionSupported(requiredVersion)) {
this.viewContainer.createEmbeddedView(this.templateRef);
} else {
this.viewContainer.clear();
}
});
}
Expand Down

0 comments on commit f3e5dfe

Please sign in to comment.