0

Getting content from another controller via this.get("controllers.index.content") or this.get("controllers.index.arrangedContent") (for sorted content) doesn't work when using the ember-localstorage-adapter on the backend.
For example, getting content from another controller:

App.StartController = Ember.ObjectController.extend({
needs: 'index',
someFunction: function() {
    // get the "content" from the IndexController
    var names = this.get("controllers.index.arrangedContent");
    alert(names.objectAt(0).name); // should display the name property from
first stored object(if there are any stored in local storage of course),
instead, it always returns "undefined"
}
});

What am I doing wrong here? Here's an example jsfiddle

4

1 回答 1

0

same problem as in Ember loop through content of controller

you have to use

alert(names.objectAt(0).get('name'));
于 2013-06-13T17:19:03.427 回答