open-consul/ui/packages/consul-ui/app/components/route/index.js
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

29 lines
574 B
JavaScript

import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
export default class RouteComponent extends Component {
@service('routlet') routlet;
@tracked model;
get title() {
return this.args.title;
}
get params() {
return this.routlet.paramsFor(this.args.name);
}
@action
connect() {
this.routlet.addRoute(this.args.name, this);
}
@action
disconnect() {
this.routlet.removeRoute(this.args.name, this);
}
}