I have two functions that i would like to execute one after the other. One sets one object and the next sets the other object based off of a property of the first object. For some reason, the first object sets fine and i can see the second object properly in the console, yet when i try and set it to my second object it defers back to the first.
setObject1(){
var self = this;
this.Service.getObject1().then(function(data){
if(data){
self.Object1 = data.Data;
self.setObject2();
}
});
}
setObject2(){
var self2 = this;
this.Service2.getObject2(this.Object1.HRRef).then(function(sdata){
if(sdata){
self2.Object2 = sdata[0];
}
});
}
I can see both objects fine in the console, yet when i try and set the self2.Object2 = sdata[0], it doesnt get set.