Get route parameters in component

后端 未结 2 1091
离开以前
离开以前 2020-12-19 09:15

I am working on the Angular-6 project. I have many child routes for my application. One of them is as follow:

  const routes: Routes = [
  {
    path: \'inn         


        
2条回答
  •  [愿得一人]
    2020-12-19 09:46

    Use Activated Route. As index of the params array you can use any parameter name.

    constructor(private itunes:SearchService,
        private route: ActivatedRoute) {
    
        this.route.params.subscribe( params => params[]); 
    }
    

提交回复
热议问题