# Showing different content for mobile view in a .gjs file

**URL:** https://meta.discourse.org/t/showing-different-content-for-mobile-view-in-a-gjs-file/374657
**Category:** Development
**Tags:** mobile, ember
**Created:** [July 17, 2025, 3:39pm UTC](https://meta.discourse.org/t/showing-different-content-for-mobile-view-in-a-gjs-file/374657 "2025-07-17T15:39:55Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![Alteras](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alteras/32/179824_2.png) [@Alteras](https://meta.discourse.org/u/Alteras)
#### Post date: [July 17, 2025, 11:21pm UTC](https://meta.discourse.org/t/showing-different-content-for-mobile-view-in-a-gjs-file/374657/4 "2025-07-17T23:21:53Z")

</div>

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.)](https://meta.discourse.org/t/ember-object-ownership-getowner-service-injections-etc/292080)

---

_[View the full topic](https://meta.discourse.org/t/showing-different-content-for-mobile-view-in-a-gjs-file/374657)._
