lundi 1 août 2016

calling function sequentially in vuejs

I am having some problem in vuejs in executing a function/method sequentially.
I have three functions like :

    MethodA: function(){

     if(x = 1){
      value1 = 2;
    }

    if (x ==2){
     value2 = 4;
    }
   this.MethodB();
  }

    MethodB: function(){
    Total value = value1 + value2;
    }

    MethodC: function (){


          this.$http.get('api/getvalue').then(function(response){
             this.set('somedata', response.data);

             response.data.forEach(para){
             if(para.id == 1){
               this.MethodA();
              }
             if(para.id == 2){
             this.MethodB();
             }

        }
   });

}
ready: function(){
this.MethodC();
}

I would like to execute this.MethodB() only after MethodA and MethodB has completely executed. How can i do this?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2ao8TTc
via IFTTT

Aucun commentaire:

Enregistrer un commentaire