Revize c9f649fd
Přidáno uživatelem castic96 před asi 4 roky(ů)
fe/fulltextsearch/src/app/components/shared-components/search-box/search-box.component.ts | ||
---|---|---|
1 |
import {Component, OnDestroy, OnInit} from '@angular/core';
|
|
1 |
import { Component, OnDestroy, OnInit } from '@angular/core';
|
|
2 | 2 |
import { SearchRequest } from '../../../model/SearchRequest'; |
3 | 3 |
import { QueryService } from '../../../services/query/query.service'; |
4 | 4 |
import { Router } from '@angular/router'; |
5 | 5 |
import { DataHolderService } from '../../../services/data-holder/data-holder.service'; |
6 |
import {Subscription} from 'rxjs';
|
|
6 |
import { Subscription } from 'rxjs';
|
|
7 | 7 |
|
8 | 8 |
@Component({ |
9 | 9 |
selector: 'app-search-box', |
... | ... | |
11 | 11 |
styleUrls: ['./search-box.component.css'] |
12 | 12 |
}) |
13 | 13 |
export class SearchBoxComponent implements OnInit, OnDestroy { |
14 |
enableSpellCheck: boolean; |
|
14 | 15 |
expression: string; |
15 | 16 |
private queryServiceSubscription$: Subscription; |
16 | 17 |
|
17 | 18 |
constructor(private queryService: QueryService, private router: Router, private dataHolderService: DataHolderService) { } |
18 | 19 |
|
19 | 20 |
ngOnInit(): void { |
21 |
this.enableSpellCheck = false; |
|
22 |
} |
|
23 |
|
|
24 |
onToggle() { |
|
25 |
this.enableSpellCheck = !this.enableSpellCheck; |
|
26 |
console.log('kontrola spell check: ' + this.enableSpellCheck); |
|
20 | 27 |
} |
21 | 28 |
|
22 | 29 |
onSubmit(): void { |
23 | 30 |
if (!this.expression) { return; } |
24 | 31 |
|
25 |
const searchRequest: SearchRequest = new SearchRequest(this.expression, new Date()); |
|
26 |
console.log('odeslano: ' + JSON.stringify(searchRequest)); |
|
32 |
const searchRequest: SearchRequest = new SearchRequest(this.expression, new Date(), this.enableSpellCheck); |
|
27 | 33 |
|
28 | 34 |
this.queryServiceSubscription$ = this.queryService.searchPost(searchRequest).subscribe (data => { |
29 | 35 |
this.dataHolderService.setData(data); |
... | ... | |
34 | 40 |
} |
35 | 41 |
|
36 | 42 |
ngOnDestroy(): void { |
37 |
console.log(this.queryServiceSubscription$); |
|
38 | 43 |
if (this.queryServiceSubscription$ !== undefined) { |
39 |
console.log('podminka'); |
|
40 | 44 |
this.queryServiceSubscription$.unsubscribe(); |
41 | 45 |
} |
42 | 46 |
} |
Také k dispozici: Unified diff
Re #8027: Checkbox pro spell checker FE
- vytvořen checkbox pro autocorrect