官术网_书友最值得收藏!

  • Angular Router
  • Victor Savkin
  • 139字
  • 2021-07-09 19:20:31

URL format

Since I will use a lot of URLs in the following examples, let's quickly look at the URL formats:

  • /inbox/33(popup:compose)
  • /inbox/33;open=true/messages/44

As you can see, the router uses parentheses to serialize secondary segments (for example, popup:compose), the colon syntax to specify the outlet, and the ;parameter=value syntax (for example, open=true) to specify route specific parameters.

In the following examples we assume that we have given the following configuration to the router, and we are navigating to /inbox/33/messages/44:

[
  { path: '', pathMatch: 'full', redirectTo: '/inbox' },
  {
    path: ':folder',
    children: [
      {
        path: '',
        component: ConversationsCmp
      },
      {
        path: ':id',
        component: ConversationCmp,
        children: [
          { path: 'messages', component: MessagesCmp },
          { path: 'messages/:id', component: MessageCmp }
        ]
      }
    ]
  },
  {
    path: 'compose',
    component: ComposeCmp,
    outlet: 'popup'
  },
  {
    path: 'message/:id',
    component: PopupMessageCmp,
    outlet: 'popup'
  }
]
主站蜘蛛池模板: 吴川市| 周至县| 闵行区| 宝丰县| 垣曲县| 新营市| 潞西市| 昆山市| 保定市| 怀安县| 蒲城县| 迁西县| 新宁县| 土默特左旗| 永昌县| 含山县| 万源市| 屏南县| 黄陵县| 张掖市| 栾城县| 星座| 云梦县| 望城县| 新蔡县| 剑河县| 安岳县| 巢湖市| 昌图县| 马鞍山市| 瑞金市| 宁阳县| 泰安市| 汝州市| 伊春市| 芜湖县| 威海市| 河南省| 北流市| 丰镇市| 清水河县|