fixed an issue where the server-side would crash if the page contained nouislider

This commit is contained in:
Art Lowel
2018-07-13 16:36:36 +02:00
parent 0ad4edb523
commit fd916501de
4 changed files with 18 additions and 6 deletions

View File

@@ -16,8 +16,11 @@
</div>
<input type="submit" class="d-none"/>
</form>
<ng-container *ngIf="shouldShowSlider()">
<nouislider [connect]="true" [min]="min" [max]="max" [step]="1"
[(ngModel)]="range" (mouseup)="onSubmit(form.value)" ngDefaultControl></nouislider>
</ng-container>
<ng-container *ngFor="let page of (filterValues$ | async)">
<ng-container *ngFor="let value of (page | async)?.payload.page">
@@ -32,4 +35,4 @@
</ng-container>
</ng-container>
</div>
</div>
</div>

View File

@@ -1,4 +1,5 @@
import { Component, Inject, OnInit } from '@angular/core';
import { isPlatformBrowser } from '@angular/common';
import { Component, Inject, OnInit, PLATFORM_ID } from '@angular/core';
import { FilterType } from '../../../search-service/filter-type.model';
import { renderFacetFor } from '../search-filter-type-decorator';
import { SearchFacetFilterComponent } from '../search-facet-filter/search-facet-filter.component';
@@ -36,6 +37,7 @@ export class SearchRangeFilterComponent extends SearchFacetFilterComponent imple
protected router: Router,
@Inject(FILTER_CONFIG) public filterConfig: SearchFilterConfig,
@Inject(SELECTED_VALUES) public selectedValues: string[],
@Inject(PLATFORM_ID) private platformId: any,
private route: ActivatedRoute) {
super(searchService, filterService, router, filterConfig, selectedValues);
}
@@ -83,4 +85,11 @@ export class SearchRangeFilterComponent extends SearchFacetFilterComponent imple
}
}
/**
* TODO when upgrading nouislider, verify that this check is still needed.
*/
shouldShowSlider(): boolean {
return isPlatformBrowser(this.platformId);
}
}