Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -2,12 +2,14 @@ import {NgModule} from '@angular/core';
|
|||||||
import {RouterModule} from '@angular/router';
|
import {RouterModule} from '@angular/router';
|
||||||
import {HomeComponent} from './home/home.component';
|
import {HomeComponent} from './home/home.component';
|
||||||
import {DetailComponent} from "./detail/detail.component";
|
import {DetailComponent} from "./detail/detail.component";
|
||||||
|
import {ListComponent} from "./list/list.component";
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [RouterModule.forRoot([
|
imports: [RouterModule.forRoot([
|
||||||
{path: 'home', component: HomeComponent},
|
{path: 'home', component: HomeComponent},
|
||||||
{path: 'detail', component: DetailComponent},
|
{path: ':location', component: ListComponent},
|
||||||
|
{path: ':location/detail/:id', component: DetailComponent},
|
||||||
{path: '**', redirectTo: 'home'}
|
{path: '**', redirectTo: 'home'}
|
||||||
])],
|
])],
|
||||||
exports: [RouterModule],
|
exports: [RouterModule],
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
|
import {ActivatedRoute} from "@angular/router";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-detail',
|
selector: 'app-detail',
|
||||||
@@ -6,8 +7,19 @@ import {Component, OnInit} from '@angular/core';
|
|||||||
styleUrls: ['./detail.component.css']
|
styleUrls: ['./detail.component.css']
|
||||||
})
|
})
|
||||||
export class DetailComponent implements OnInit {
|
export class DetailComponent implements OnInit {
|
||||||
|
private location: string | undefined;
|
||||||
|
private id: number | undefined;
|
||||||
|
|
||||||
|
constructor(private route: ActivatedRoute) {
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
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();
|
this.getLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user