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

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -