-
Notifications
You must be signed in to change notification settings - Fork 0
#T13 add filter by rating #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
<!-- title --> | ||
<h5 class="mb-3">Rating</h5> | ||
|
||
<div class="form-check mb-2" *ngFor="let star_list of [].constructor(5); let i = index"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
czy jest może jakiś ładniejszy sposób na to żeby wygenerować te gwiazdki?
wiem, że moglabym wrzucic tą 5 do zmiennej i byloby troche ladniej, ale chodzi mi o cos jeszcze bardziej poprawnego
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tak, można w ts zrobić np. tablicę obiektów, gdzie obiekt by miał dane potrzebne do prezentacji gwiazdki. Ciekawy sposób masz ale raczej tak nie robimy
) | ||
.subscribe(); | ||
|
||
onCheckChange(event:Event) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
czy jest może jakiś lepszy typ niż Event, tak żebym nie musiała póżniej zapisywać eventTarget jako HTMLInputElement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
w zwykłym bootstrapowym checkbox chyba nie, tutaj ewentualnie dać typ 'any' zamiast Event, ale Twoje rozwiązanie na plus
W angular material jest event specjalny z którym jest dużo łatwiej
this.category, | ||
this.sortBy$, | ||
this.searchForm.valueChanges.pipe(startWith({ priceFrom: -1, priceTo: 9999999 })), | ||
this.searchForm.valueChanges.pipe(startWith({ priceFrom: -1 })), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
czemu właściwie muszę podać cokolwiek w startWith? jesli usune tez i priceFrom to przestaje mi sie wyswietlac lista
to dlatego że w 94 linijce w category-products.components.ts mam combineLatest i musi się wygenerować jakakolwiek wartość dla searchForm, żeby dostarczyło wszystkie elementy do combineLatest i przeszło dalej?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dokładnie tak, bez tego dane załadowałyby się dopiero po zmianach w formularzu np. dodaniu priceFrom
// find the unselected element | ||
let i: number = 0; | ||
|
||
formArray.controls.forEach((ctrl: AbstractControl) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tutaj w przykładzie było żeby ctrl oznaczyc jako FormControl, ale nie działało i musiałam użyć AbstractControl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Przykład który podałaś jest sprzed 6 lat, to dużo jak na programowanie xd
możesz nie robić tego na forEach tylko znaleźć index za pomocą metody findIndex na formArray.controls i po tym indeksie usunąć element.
Zmienna 'let i' jest tutaj niepotrzebna, metoda forEach jako drugi parametr ma index elementu np.
formArray.controls.forEach((ctr: AbstractControl, idx) => { ... })
Nie jestem pewien, ale FormControl rozszerza AbstractControl, i tym może to być spowodowane co do typu.
No description provided.