Showing different content for mobile view in a .gjs file

No. The @service decorator is only available in Ember classes like Components or Services. If the <template>...</template> was refactored as a separate component, then you can use the decorator. As the apiInitializer() is only a function, the service has to be accessed like normal JS.

You can see Ember object ownership (getOwner, service injections, etc.)

1 Like