javascript - Can't access self variable inside query function -
//this route function dosomething(){ var self=this; var a,b,c; //do reqarray="somevalue"; this.store.query("record",{"filter":"[{'api_name':'somevalue','comparator':'somevalue','value':"+reqarray+"}]"}) .then(function(data){ //can't access a,b,c or self }); }
i data need inside function after promise resolved not able access outside function.
editing more clarification: variable inside function window.i want able reference route .
if need vars in object, can :
function dosomething(){ var self=this; var a,b,c; //do // save value self.a = a; self.b = b; self.c = c; reqarray="somevalue"; this.store.query("record",{"filter":"[{'api_name':'somevalue','comparator':'somevalue','value':"+reqarray+"}]"}).then( (function(data){ // = self // this.a = // ... }).bind(self)); }
Comments
Post a Comment