Difference between [routerLink] and routerLink

前端 未结 3 1519
长发绾君心
长发绾君心 2020-12-07 13:49

What is the difference between [routerLink] and routerLink ? How should you use each one?

3条回答
  •  一向
    一向 (楼主)
    2020-12-07 14:18

    Assume that you have

    const appRoutes: Routes = [
      {path: 'recipes', component: RecipesComponent }
    ];
    
    Recipes
    

    It means that clicking Recipes hyperlink will jump to http://localhost:4200/recipes

    Assume that the parameter is 1

    
    

    It means that passing dynamic parameter, 1 to the link, then you navigate to http://localhost:4200/recipes/1

提交回复
热议问题