calling both GET and POST service calls in same function using angular 2

后端 未结 1 608
时光取名叫无心
时光取名叫无心 2021-01-29 04:13

How do i call http POST service call after the GET, if response is success.

I have the written the GET call in the following way,

import {Page, NavContro         


        
相关标签:
1条回答
  • 2021-01-29 04:50
     **It could be better if you use another Function sucees**  
    
      onLogin(value: string): void { 
       if(this.authForm.valid) {        
         this.http.get('https://itunes.apple.com/us/rss/topmovies/limit=1/json')
         .map(res => res.json())
          .subscribe(
           data => {console.log(JSON.stringify(data));},
           err => this.logError(err),
           () => this.add();
          );
    
         this.nav.push(AccountViewPage);
      }
      } 
    
      public add(): void {
      // another service here
      }
    
    0 讨论(0)
提交回复
热议问题