Skip to content

Handling model with data that has not yet resolved

Hi

If I use the following it crashes because the model is undefined at that stage.

filsorDataKey: "model",
	
init: function(){

   this._super(...arguments);	
   this.send('filsorSort', 'string', 'title');		
},

If I replace it with the following it works.

filsorDataKey: "model",
	
init: function(){

	this._super(...arguments);
	let that = this;

	Ember.run.later((function() {
		that.send('filsorSort', 'string', 'title');
	}), 2000);	
},

Is there a recommended/better way of handling this?