src/app/shared/components/run-spatial-search/run-spatial-search.component.ts
Button that opens up the Spatial Search config
changeDetection | ChangeDetectionStrategy.OnPush |
selector | ccf-run-spatial-search |
styleUrls | ./run-spatial-search.component.scss |
templateUrl | ./run-spatial-search.component.html |
Properties |
|
Methods |
HostBindings |
constructor(store: Store, dialog: MatDialog)
|
|||||||||
Parameters :
|
class |
Type : "ccf-run-spatial-search"
|
Default value : 'ccf-run-spatial-search'
|
HTML class |
startSpatialSearchFlow |
startSpatialSearchFlow()
|
Starts spatial search flow
Returns :
void
|
Readonly className |
Type : string
|
Default value : 'ccf-run-spatial-search'
|
Decorators :
@HostBinding('class')
|
HTML class |
import { ChangeDetectionStrategy, Component, HostBinding } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { Store } from '@ngxs/store';
import { take, tap } from 'rxjs/operators';
import { StartSpatialSearchFlow } from '../../../core/store/spatial-search-ui/spatial-search-ui.actions';
import { SpatialSearchConfigBehaviorComponent } from '../spatial-search-config-behavior/spatial-search-config-behavior.component';
/**
* Button that opens up the Spatial Search config
*/
@Component({
selector: 'ccf-run-spatial-search',
templateUrl: './run-spatial-search.component.html',
styleUrls: ['./run-spatial-search.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class RunSpatialSearchComponent {
/** HTML class */
@HostBinding('class') readonly className = 'ccf-run-spatial-search';
constructor(
private readonly store: Store,
private readonly dialog: MatDialog,
) {}
/**
* Starts spatial search flow
*/
startSpatialSearchFlow(): void {
this.store
.dispatch(new StartSpatialSearchFlow())
.pipe(
take(1),
tap(() => this.dialog.open(SpatialSearchConfigBehaviorComponent)),
)
.subscribe();
}
}
<button class="run-spatial-search-button" mat-button (click)="startSpatialSearchFlow()">
Run Spatial Search
<mat-icon>travel_explore</mat-icon>
</button>
./run-spatial-search.component.scss
:host {
.run-spatial-search-button {
display: flex;
flex-direction: row-reverse;
align-items: center;
border-width: 1px;
border-style: solid;
white-space: nowrap;
height: 2rem;
width: 13rem;
.mat-icon {
height: 1.5rem;
width: 1.5rem;
font-size: 1.5rem;
margin-left: 0.5rem;
}
}
}