added search component from all pages
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import { Component } from '@angular/core';
|
||||
import {NzIconDirective} from "ng-zorro-antd/icon";
|
||||
import {NzColDirective} from "ng-zorro-antd/grid";
|
||||
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent} from "ng-zorro-antd/form";
|
||||
import {FormControl, FormGroup, ReactiveFormsModule} from "@angular/forms";
|
||||
|
||||
@Component({
|
||||
selector: 'app-search',
|
||||
imports: [
|
||||
NzIconDirective,
|
||||
NzColDirective,
|
||||
NzFlexDirective,
|
||||
NzFormControlComponent,
|
||||
NzFormDirective,
|
||||
NzFormItemComponent,
|
||||
ReactiveFormsModule
|
||||
],
|
||||
templateUrl: './search.html',
|
||||
styleUrl: './search.css',
|
||||
})
|
||||
export class Search {
|
||||
searchForm: FormGroup = new FormGroup({
|
||||
searchValue: new FormControl<string>(null)
|
||||
})
|
||||
|
||||
submitForm() {
|
||||
// Pour annuler si le formulaire est invalide
|
||||
if (this.searchForm.invalid) return;
|
||||
|
||||
// Pour obtenir la valeur du formulaire
|
||||
console.log(this.searchForm.getRawValue())
|
||||
|
||||
// Pour vider le formulaire
|
||||
this.searchForm.reset()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user