added language routing system
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
import { Component, OnInit, signal, computed, ChangeDetectionStrategy } from '@angular/core';
|
||||
import { Router, RouterLink } from '@angular/router';
|
||||
import { ApiService } from '../../services';
|
||||
import { ApiService, LanguageService } from '../../services';
|
||||
import { Category } from '../../models';
|
||||
import { environment } from '../../../environments/environment';
|
||||
import { ItemsCarouselComponent } from '../../components/items-carousel/items-carousel.component';
|
||||
import { LangRoutePipe } from '../../pipes/lang-route.pipe';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
imports: [RouterLink, ItemsCarouselComponent],
|
||||
imports: [RouterLink, ItemsCarouselComponent, LangRoutePipe],
|
||||
templateUrl: './home.component.html',
|
||||
styleUrls: ['./home.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
@@ -48,7 +49,7 @@ export class HomeComponent implements OnInit {
|
||||
return cache;
|
||||
});
|
||||
|
||||
constructor(private apiService: ApiService, private router: Router) {}
|
||||
constructor(private apiService: ApiService, private router: Router, private langService: LanguageService) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.loadCategories();
|
||||
@@ -103,7 +104,8 @@ export class HomeComponent implements OnInit {
|
||||
}
|
||||
|
||||
navigateToSearch(): void {
|
||||
this.router.navigate(['/search']);
|
||||
const lang = this.langService.currentLanguage();
|
||||
this.router.navigate([`/${lang}/search`]);
|
||||
}
|
||||
|
||||
scrollToCatalog(): void {
|
||||
|
||||
Reference in New Issue
Block a user