Ember-CLI - How to access application classes

Previously, when I was developing an ember application, I used the application as my global object, and each class was stored in this large object.

Like this

window.App.MyModel = Em.Object.extend({});

And in the browser console I was able to do

App.MyModel.create();

It was very easy for me to access the MyModel class.

Now I started experimenting with Ember-CLI, I do not have much experience working with such tools. I followed the documentation and I created my Service model like this.

var Service = Ember.Object.extend({});
export default Service

But now, how to access the Service class from the browser console? The only way I found:

App.__container__.resolve('model:service')

But I do not like it. Is there a better way? By the way, could you explain how export works? Or is there some kind of source (documentation, article) where I can study it?

Thank you very much for your reply.

+4
1

- , .

, , , , . - " , __container__, ".

, , initializer. ember-cli , .

, , , .

, register inject, . . , ( ) App.__container__, .

export, , ES6, Ember. ES6 , , , " ".

+9

Source: https://habr.com/ru/post/1536828/


All Articles