lundi 16 novembre 2015

Using Dependency Injected Fields in Ember Controllers

How do I use a dependency injected field in another field within the ember controller in 2.x Ember?

For instance, I have

  export default Ember.Controller.extend({
     session: Ember.inject.service('session'),
     user: this.get('session').username

How is user able to access the lazily computed values of session?

I noticed that the case above doesn't work as I believe the value of session has been computed yet?

I could use a computed property but I use user as a value in input and I am merely setting a base value.

Aucun commentaire:

Enregistrer un commentaire