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

Router configuration

The router configuration defines all the potential router states of the application. Let's look at an example:

[
  {
    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'
  }
]

Don't worry about understanding all the details. I will cover them in later chapters. For now, let's depict the configuration as follows:

As you can see the router configuration is a tree, with every node representing a route. Some nodes have components associated with them, some do not. We also use color to designate different outlets, where an outlet is a location in the component tree where a component is placed.

主站蜘蛛池模板: 西城区| 克什克腾旗| 靖江市| 丁青县| 闽清县| 海安县| 库尔勒市| 兴文县| 盘山县| 文昌市| 文登市| 历史| 大荔县| 乡宁县| 新平| 霍邱县| 海城市| 丹寨县| 霍林郭勒市| 句容市| 崇仁县| 都匀市| 黄龙县| 枣强县| 崇义县| 远安县| 石棉县| 噶尔县| 兰州市| 黄大仙区| 东光县| 富顺县| 莱芜市| 霍州市| 瑞昌市| 汉川市| 和林格尔县| 扎赉特旗| 浙江省| 乌鲁木齐市| 太原市|