Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
tito
2023-03-07 14:50:29 +01:00
2 changed files with 16 additions and 2 deletions

View File

@@ -2,12 +2,14 @@ import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {HomeComponent} from './home/home.component';
import {DetailComponent} from "./detail/detail.component";
import {ListComponent} from "./list/list.component";
@NgModule({
imports: [RouterModule.forRoot([
{path: 'home', component: HomeComponent},
{path: 'detail', component: DetailComponent},
{path: ':location', component: ListComponent},
{path: ':location/detail/:id', component: DetailComponent},
{path: '**', redirectTo: 'home'}
])],
exports: [RouterModule],

View File

@@ -1,4 +1,5 @@
import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from "@angular/router";
@Component({
selector: 'app-detail',
@@ -6,8 +7,19 @@ import {Component, OnInit} from '@angular/core';
styleUrls: ['./detail.component.css']
})
export class DetailComponent implements OnInit {
private location: string | undefined;
private id: number | undefined;
constructor(private route: ActivatedRoute) {
}
ngOnInit(): void {
this.route.params.subscribe(params => {
this.location = params['location'];
this.id = params['id'];
})
console.log(this.location);
console.log(this.id);
this.getLocation();
}