问题
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
回答1:
same problem as in Ember loop through content of controller
you have to use
alert(names.objectAt(0).get('name'));
来源:https://stackoverflow.com/questions/17065647/ember-getting-content-from-another-controller-doesnt-work-with-local-storage-ad