samedi 26 août 2017

How to inject `responsive` object to application

I am trying to inject the ember-responsive module to application. for it's not works. I have installed http://ift.tt/1my8I5B responsive module to application. I directly tried to get the value of media in my route like :

`export default Ember.Route.extend({

init(){
    console.log("initated", this.get('media.isMobile') ); // => true );
},

But not worked. then I created ajsfile atapp/breakpoints.js` and configured like:

`export default { mobile: '(max-width: 768px)', desktop: '(min-width: 769px)' }

`

But still my route gives this.get('media.isMobile') as undifed. now I am tryinng to inject my breakpoints to app. for that I try like this:

export function initialize(application) {
   application.inject('route', 'mockService', 'service:mock-service');
   application.inject('route', 'media', 'breakpoints');
}

export default {
  name: 'mock',
  name: 'media',
  initialize
};

But still getting error as :

TypeError: Invalid Fullname, expected: 'type:name' got: breakpoints how to solve this? and what is wrong I did here?




Aucun commentaire:

Enregistrer un commentaire