Jo Liss
Jo Liss

Reputation: 32945

Ember: How to get class properties

Given an Ember class with properties, like so:

User = Ember.Object.extend({
  foo: 42
});

how do I access the value of foo if I have only the User class? I do not want to .create an instance.

Upvotes: 4

Views: 1216

Answers (2)

vampolo
vampolo

Reputation: 107

I've solved with:

User.proto().foo

Upvotes: 1

sly7_7
sly7_7

Reputation: 12011

Hum, try it:

Ember.keys(User.proto()).forEach(function(prop){console.log(Ember.get(User.proto(), prop))})

Upvotes: 5

Related Questions