[develop | DONE | ADDED] slider-tabs component: add condition to disable slider-arrows if isServer is true

This commit is contained in:
Alex Martzios 2024-03-28 13:22:21 +02:00
parent cafe0e4926
commit 894667955c
1 changed files with 12 additions and 4 deletions

View File

@ -6,11 +6,14 @@ import {
ElementRef, EventEmitter, ElementRef, EventEmitter,
Input, OnDestroy, Output, Input, OnDestroy, Output,
QueryList, QueryList,
ViewChild ViewChild,
Inject,
PLATFORM_ID
} from "@angular/core"; } from "@angular/core";
import {SliderTabComponent} from "./slider-tab.component"; import {SliderTabComponent} from "./slider-tab.component";
import {ActivatedRoute, Router} from "@angular/router"; import {ActivatedRoute, Router} from "@angular/router";
import {Subscription} from "rxjs"; import {Subscription} from "rxjs";
import {isPlatformServer} from "@angular/common";
import Timeout = NodeJS.Timeout; import Timeout = NodeJS.Timeout;
declare var UIkit; declare var UIkit;
@ -78,8 +81,10 @@ declare var UIkit;
</ng-container> </ng-container>
</ul> </ul>
</div> </div>
<ng-container *ngIf="!isServer">
<slider-arrow *ngIf="position === 'horizontal' && arrows" type="previous"></slider-arrow> <slider-arrow *ngIf="position === 'horizontal' && arrows" type="previous"></slider-arrow>
<slider-arrow *ngIf="position === 'horizontal' && arrows" type="next"></slider-arrow> <slider-arrow *ngIf="position === 'horizontal' && arrows" type="next"></slider-arrow>
</ng-container>
</div> </div>
`, `,
}) })
@ -143,10 +148,13 @@ export class SliderTabsComponent implements AfterViewInit, OnDestroy {
private subscriptions: any[] = []; private subscriptions: any[] = [];
private observer: IntersectionObserver; private observer: IntersectionObserver;
private timeout: Timeout; private timeout: Timeout;
isServer: boolean;
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private router: Router, private router: Router,
private cdr: ChangeDetectorRef) { private cdr: ChangeDetectorRef,
@Inject(PLATFORM_ID) private platform: any) {
this.isServer = isPlatformServer(this.platform);
} }
ngAfterViewInit() { ngAfterViewInit() {