here is my ngOnInit in my component -
ngOnInit() {
this.route.queryParams.subscribe(
(params) => {
console.log(params);
}
)
}
here is my resolver -
class ProductsResolver implements Resolve<
Pick<IProductInterface, 'image' | 'title' | 'price' | 'description'>[]>
{
constructor(private productService: ProductService) {}
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<Pick<
IProductInterface, 'image' | 'title' | 'price' | 'description'>[]
> {
return this.productService.getProducts(
route.paramMap.get('gender')! as ProductGender,
+route.paramMap.get('category')! as ProductCategory,
);
}
}
how can i pass the params to the resolver. i am trying to get from my nav a link and then go to product-list page and present the data with the queryParams.
my html -
<a
class="linkCategoriesInner__link"
[routerLink]="['/product-list']"
[queryParams]="{ gender: 'women', category: 6 }">
Hats
</a>