Angular.js
Angular.js Routing Parameter전달
개발자자자
2020. 8. 10. 13:54
다음과 같이 라우팅 Path 를 설정해주고.
--- app-routing.module.ts ---------
import { AaaComponent } from ' ./ aaa.component '
const routes: Routes= [
{ path : 'aaa/:param', component: AaaComonent' } ,
]
-----------------------------------
라우팅 시킬 네비게이션메뉴 등에서 다음과 같은 (click) 함수를 쓸것이다.
--- nav.component.ts --------------
gotoAaaComp() {
this.router.navigate([`/aaa/${this.data}`]);
}
-----------------------------------
--- nav.component.html-------------
<a class="bottons" (click)="gotoAaaComp()" >
-----------------------------------