[Angular] 앵귤러 RouterModule 사용 및 실습 :: 마이자몽
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
import { Component, OnInit } from '@angular/core' ; import { ActivatedRoute } from '@angular/router' ; @ Component({ selector: 'app-category-list-item' , templateUrl: './category-list-item.component.html' , styleUrls: [ './category-list-item.component.css' ] }) export class CategoryListItemComponent implements OnInit { constructor ( private route: ActivatedRoute) { } ngOnInit() { this .route.paramMap.subscribe(params = > { console.log(params); let id: number = + params. get ( 'id' ); let name: string = params. get ( 'name' ); console.log(id + " " + name); }) } }
from http://myjamong.tistory.com/32 by ccl(A) rewrite - 2020-03-06 16:20:46
댓글
댓글 쓰기