open-consul/ui/packages/consul-ui/app/components/route
John Cowen 7083c39b96
ui: Support Route optional parameters/segments (#10212)
Moves our URLs with 'optional namespace segment' into a separately abstracted 'optional URL segment' feature
2021-05-26 17:43:46 +01:00
..
README.mdx ui: Support Route optional parameters/segments (#10212) 2021-05-26 17:43:46 +01:00
index.hbs ui: Support Route optional parameters/segments (#10212) 2021-05-26 17:43:46 +01:00
index.js ui: Support Route optional parameters/segments (#10212) 2021-05-26 17:43:46 +01:00

README.mdx

# Route

The `Route` component should be used for the top-level component for *every*
route/page template. It provides/will provide functionality (along with the
`<Outlet />` component) for setting and announcing the title of the page,
passing data down through the route/template hierarchy, automatic
orchestration of nested routing and visual animating/transitioning between
routes.

## Arguments

| Argument | Type | Default | Description |
| --- | --- | --- | --- |
| `name` | `String` | `undefined` | The name of the route in ember routeName format e.g. `dc.services.index`. This is generally the `routeName` variable that is available to you in all Consul UI route/page level templates.|
| `title` | `String` | `undefined` | The title for this page (eventually passed through to the `{{page-title}}` helper. This argument should be omitted if a title change isn't required. |
| `titleSeparator` | `String` | `undefined` | This can be used in the top-level route to configure the separator for the `{{page-title}}` helper |

## Exports

| export | Type | Default | Description |
| --- | --- | --- | --- |
| `model` | `Object` | `undefined` | Arbitrary hash of data passed down from the parent route/outlet |
| `params` | `Object` | `undefined` | An object/merge of **all** optional route params and normal route params |

```hbs
<Route
  @name={{routeName}}
  @title="Page Title"
  @titleSeparator=" - "
as |route|>
  {{route.model.dc.Name}}
</Route>
```

Every page/route template has a `routeName` variable exposed specifically to
allow you to use this to set the `@name` of the route.