File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -4,16 +4,19 @@ alwaysApply: true
44When creating components, follow these rules:
55
66- Use typescript (`.ts`) files
7- - Import from `@glimmer/component`
7+ - Import from `@glimmer/component` like this: `import Component from '@glimmer/component';`
88- Use `interface Signature { ... }` to define the component's signature
99- `class` doesn't have to be in `Args`, ember automatically forwards native args like `class`, `id` etc. to the component
1010- Ensure the component is registered w/ Glint using `declare module ...`
11-
11+ - Ensure service registrations using `@service` are grouped together and sorted alphabetically
1212
1313Example:
1414
1515```ts
1616import Component from '@glimmer/component';
17+ import { service } from '@ember/service';
18+ import type RouterService from '@ember/routing/router-service';
19+ import type Store from '@ember-data/store';
1720
1821interface Signature {
1922 Element: HTMLDivElement;
@@ -25,9 +28,21 @@ interface Signature {
2528}
2629
2730export default class TrackPageCard extends Component<Signature> {
31+ @service declare router: RouterService;
32+ @service declare store: Store;
33+
2834 get property1() {
2935 return 'dummy';
3036 }
37+
38+ get property2() {
39+ return this.store.peekAll('course');
40+ }
41+
42+ @action
43+ handleClick() {
44+ this.router.transitionTo('course', 'redis');
45+ }
3146}
3247
3348declare module '@glint/environment-ember-loose/registry' {
You can’t perform that action at this time.
0 commit comments