Skip to content
Snippets Groups Projects
Commit 3c6c6734 authored by Jérémie BRISON's avatar Jérémie BRISON
Browse files

fix(form) : clean code

parent 4ed2edec
No related branches found
No related tags found
3 merge requests!68Recette,!67Dev,!66Fix/form design create structure
......@@ -10,7 +10,7 @@
#searchAddress
/>
</div>
<div class="autocomplete-items" *ngIf="!isAlreadySearch">
<div class="autocomplete-items" *ngIf="!isAlreadySearching">
<p *ngFor="let hit of data" (click)="selectedResult(hit)" class="autocomplete-item">
{{ parseHitToAddress(hit) }}
</p>
......
......@@ -10,7 +10,7 @@ import { AddressService } from '../../service/address.service';
export class AddressAutocompleteComponent implements OnInit {
public readonly AUTOCOMPLETE_NBR = 5;
public data = [];
public isAlreadySearch = false;
public isAlreadySearching = false;
@ViewChild('searchAddress', { static: true }) searchAddress: ElementRef;
@Output() selectedAddress: EventEmitter<Address> = new EventEmitter<Address>();
@Output() inputAddress: EventEmitter<any> = new EventEmitter<any>();
......@@ -25,11 +25,11 @@ export class AddressAutocompleteComponent implements OnInit {
}
}
public onSearchChange(searchString: string) {
if (!this.isAlreadySearch) {
this.isAlreadySearch = true;
if (!this.isAlreadySearching) {
this.isAlreadySearching = true;
this.addressService.searchAddress(searchString).subscribe((data) => {
this.data = data.hits.hits.slice(0, this.AUTOCOMPLETE_NBR);
this.isAlreadySearch = false;
this.isAlreadySearching = false;
});
}
this.inputAddress.emit();
......
......@@ -15,7 +15,7 @@ export class CheckboxFormComponent implements OnInit {
ngOnInit(): void {}
clicked() {
public clicked(): void {
this.isChecked = !this.isChecked;
this.checkEvent.emit(this.isChecked);
}
......
......@@ -16,15 +16,15 @@ export class CopyPasteComponent implements OnInit {
ngOnInit(): void {}
public copy() {
public copy(): void {
this.copyEvent.emit(this.day);
}
public paste() {
public paste(): void {
this.pasteEvent.emit(this.day);
}
public cancel() {
public cancel(): void {
this.cancelEvent.emit();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment