diff --git a/src/app/components/search/search.html b/src/app/components/search/search.html index 592bbb8..22e4ccb 100644 --- a/src/app/components/search/search.html +++ b/src/app/components/search/search.html @@ -1,9 +1,9 @@ -
+
- - + +
diff --git a/src/app/components/search/search.ts b/src/app/components/search/search.ts index 138e854..fb6cf6d 100644 --- a/src/app/components/search/search.ts +++ b/src/app/components/search/search.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, output } from '@angular/core'; import {NzIconDirective} from "ng-zorro-antd/icon"; import {NzColDirective} from "ng-zorro-antd/grid"; import {NzFlexDirective} from "ng-zorro-antd/flex"; @@ -24,14 +24,12 @@ export class Search { searchValue: new FormControl(null) }) - submitForm() { - // Pour annuler si le formulaire est invalide - if (this.searchForm.invalid) return; + searchEvent = output(); - // Pour obtenir la valeur du formulaire - console.log(this.searchForm.getRawValue()) + OnSearch(): void { + const raw = this.searchForm.controls['searchValue'].value ?? ''; + const value = String(raw).trim(); + this.searchEvent.emit(value); - // Pour vider le formulaire - this.searchForm.reset() } } diff --git a/src/app/components/stock-table/stock-table.html b/src/app/components/stock-table/stock-table.html index b2f26e2..b96cbf4 100644 --- a/src/app/components/stock-table/stock-table.html +++ b/src/app/components/stock-table/stock-table.html @@ -1,5 +1,5 @@ - @for (product of products(); track product.id) { + @for (product of filteredProducts(); track product.id) {