mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
* fixed the version-compatibility.directive (#6391)
This commit is contained in:
@@ -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: `
|
||||
@@ -63,8 +63,7 @@ describe('VersionCompatibilityDirective', () => {
|
||||
TranslateModule.forRoot(),
|
||||
CoreTestingModule
|
||||
],
|
||||
declarations: [TestComponent
|
||||
]
|
||||
declarations: [TestComponent]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
@@ -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]'
|
||||
@@ -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();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user