Ember.js - setupController model no output
By : Bipul Pandey
Date : March 29 2020, 07:55 AM
With these it helps There is no relation between the problem and setupController. The problem is you are trying to access a property which you have not defined in the model. code :
App.OldProjects = DS.Model.extend({
title: DS.attr('string'),
project: DS.attr('string'),
name: DS.attr('string'),
img: DS.attr('string')
});
|
Ember.js Route.setupController with ObjectController
By : harding
Date : March 29 2020, 07:55 AM
|
Ember setupController and transient controllers
By : Ofir Geva
Date : March 29 2020, 07:55 AM
wish of those help This appears to be an actual bug, since the instance of the controller is different from the instance you have in setupController and the one backing the view. A workaround would be overriding the renderTemplate hook on your route to pass the instance of the controller versus a string reference which is looked up by default (and creating a new instance of the controller!). code :
export default Ember.Route.extend({
setupController(controller, model) {
this._super(...arguments);
controller.set('var1', 'foo');
},
renderTemplate(controller, model) {
// note: don't call super here
this.render('application', {
controller: controller,
model: model
});
}
});
|
SetupController for Component Ember
By : Dragan Jeremic
Date : March 29 2020, 07:55 AM
Hope that helps This sounds like a problem that could be resolved through Ember.Service. You can go about it in a couple ways, but the more straightforward might be to inject the service into the component and bind isVisible. Something like: code :
export default Ember.Service.extend({
isVisible: false
});
export default Ember.Component.extend({
visibility: Ember.inject.service(),
isVisible: Ember.computed.alias('visibility.isVisible')
});
export default Ember.Route.extend({
visibility: Ember.inject.service(),
afterModel() {
this.set('visibility.isVisible', true);
}
});
|
Ember setupController request
By : Alexandru Dinu
Date : March 29 2020, 07:55 AM
wish help you to fix your issue Sure just use native jQuery AJAX calls. Something like this: Route code :
import Ember from 'ember';
export default Ember.Route.extend({
model: function(){
return this.store.findAll('podcast')
},
setupController(controller, model) {
controller.set('podcastFeeds', []);
model.forEach( podcast => {
Ember.$.ajax({
url: podcast.get('feed'), // get the property
}).then( feedData => {
controller.get('podcastFeeds').addObject(feedData);
}, () => {
//handle error
});
});
}
});
{{#each podcastFeeds as |podcastFeed|}}
{{{podcastFeed}}}
{{/each}}
|