-
Notifications
You must be signed in to change notification settings - Fork 15
feat: ДЗ 9. Реализация навигации по субкатегории #115
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: lecture-9
Are you sure you want to change the base?
Conversation
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.
Привет!
Оставил пару комментариев, посмотри, пожалуйста
@@ -38,6 +38,10 @@ const routes: Routes = [ | |||
}, | |||
], | |||
}, | |||
{ | |||
path: ':id', |
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.
Почему решил добавить отдельным динамическим сегментом :id
? Почему не в связке products-list/:id
. На мой взгляд пути для отображения списка продуктов - products-list
and products-list/:id
выглядят консистентней нежели products-list
and :id
.
Что думаешь?
@@ -12,6 +12,7 @@ | |||
mat-button | |||
hideToggle | |||
class="sub-catigory" | |||
[routerLink]="[subCategory._id]" |
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.
А как думаешь, какая навигация тут должна быть: абсолютная или относительная?
constructor(private readonly router: Router) { | ||
} | ||
|
||
onClick(subCategory: string){ |
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.
Уже не нужно? Осталось после тестирования другой реализации?
if(subCategoryId){ | ||
this.productsStoreService.loadProducts(subCategoryId) | ||
return | ||
} | ||
this.productsStoreService.loadProducts() | ||
}) |
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.
Почему не просто передаешь subCategoryId
в метод? Он же умеет работать с null
🤔
if(subCategoryId){ | |
this.productsStoreService.loadProducts(subCategoryId) | |
return | |
} | |
this.productsStoreService.loadProducts() | |
}) | |
this.productsStoreService.loadProducts(subCategoryId) | |
}) |
map(paramMap=>{ | ||
return paramMap.get("id") | ||
}), |
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.
Рекомендую в таких случаях сокращать запись
map(paramMap=>{ | |
return paramMap.get("id") | |
}), | |
map(paramMap => paramMap.get("id")), |
No description provided.