1

I am trying to keep 2 separate template folder(s) for desktop and mobile. But I am not able to figrueout the correct way.

Any one help me for this?

If I am wrong, please correct me.

here is my requirement what I looking for :

enter image description here

Twiddle

3gwebtrain
  • 14,640
  • 25
  • 121
  • 247

1 Answers1

1

There may be a better way to achive this.

But to solve your need, you can use the templateName property of the route.

Here is the updated twiddle.

ykaragol
  • 6,139
  • 3
  • 29
  • 56
  • 1
    Is that mean each and every router has to set the template path? there is no global configuration? my project size is very large. this is not such easy to maintain the code. – 3gwebtrain Aug 24 '17 at 12:19
  • You can handle it by reopening Ember.Route. But again there need to be a better way. Eg. building two different applications for different platforms. Handling common parts in a common addon. – ykaragol Aug 24 '17 at 14:49
  • `isDesktop()` - is inbuild method? if not is there any inbuild or recommended ember approach? – 3gwebtrain Aug 26 '17 at 06:14
  • Nope its my mock implementation in the 3th line of that route. To implement it have a look at [this question](https://stackoverflow.com/questions/11381673/detecting-a-mobile-browser). Also [ember-responsive](https://github.com/freshbooks/ember-responsive) addon can help you. – ykaragol Aug 26 '17 at 07:01
  • I tried here : `https://stackoverflow.com/questions/45892997/how-to-inject-responsive-object-to-application` not working. can you help me to setup please? – 3gwebtrain Aug 26 '17 at 08:03
  • In my application router how can i get the value here is my try : `https://ember-twiddle.com/1b8b48e0dbeab6f0d870b49a548923ad?openFiles=initializers.application.js%2C` – 3gwebtrain Aug 26 '17 at 08:05
  • 1
    Put `media:Ember.inject.service(),` line to your route. Remove initializer. – ykaragol Aug 26 '17 at 08:31