.get is not a function error

At the time of Ember.Object.create , when i am trying to get the key value i am getting .get is not a function.

Do you have an example?

       obj.forEach(function(item) {
    	value:item.get("key");           
        });

For this code I am geeting .get not a function .

Try to console.log(item) in forEach’s callback, then you will see what’s the problem…

item.get("key") doesn’t work with native objects. It only works with instances of Ember.Object (and subclasses, of course).

Use the following syntax, that works for both Ember.Object instances and plain objects:

Ember.get(item, "key");

A bit more explicit, code-wise:


var obj = Ember.Object.create();
obj.get('key.down.one.more.level'); // Works and returns undefined

var obj = {};
obj.get('key.down.one.more.level'); // TypeError: undefined is not a function