היי חן

 

אני עשיתי EXPORT לכל DB, שמתי בתיקי בפרוייקט.

 

מצרפת את התיקיה הזו.

 

תודה

 

קטיה

 

From: [email protected] <[email protected]> On Behalf Of 
[email protected]
Sent: Saturday, October 24, 2020 10:55 PM
To: Angular and AngularJS discussion <[email protected]>
Subject: Re: [Angular] Re: How to call two method sequential

 

Hi Arnaud,

Thanks for your reply but this appears to be very complex for  me . I am unable 
to chain my request.

 

my first call - 

getsession() in below format

{

    "error": null,

    "sessionID": "XXXXXXXX"

}

I need to pick the session ID and then call othe function 

  getInformation ( sessionID from above response).

 

I tried to do the following thing but does not work as I get compile time error

 

this.service.getSession().pipe(

        switchMap(data =>{

          let session = data.sessionID;

          this.serice.getinformation(session );

        })

      )

I really need correct syntax for it. I struggled with all video from YouTube 
but no understanding.

Regards

Sandeep Shukla

 

On Wednesday, October 21, 2020 at 2:17:53 PM UTC+2 Arnaud Deman wrote:

Hi Sandeep,

 

The calls to the backend are actually returning Observables. This is 
asynchronous, so the second call is probably done before the first Observable 
has emitted a value. You can combine the two observables like I said in my 
previous answer. Another solution could be to perform the second call in the 
subscribe of the first one. If this diagnostic is not correct perhaps could you 
provide an minimalist stackblitz or equivalent.

Regards,
Arnaud.

 

On Tuesday, 20 October 2020 at 19:28:15 UTC+2 [email protected] wrote:

Hi Arnaud,

Thanks for your response.

I did not understand it completely. The moment I call method in subsequent 
request session becomes undefined. Here is the code I am attaching.

 

      sessionId : string = "";
      
   this.loginService.getSession(t)
      .subscribe(data => {
        this.result=JSON.parse(JSON.stringify(data));
         sessionId = this.result;
      }, error => {
        this.result = JSON.stringify(error).toString();
      });  
  // I only want to return result from below method to consumer while session 
is created in each request. I cannot store sessionId from //getSession. I am 
not sure how to combine them 
     this.loginService.searchDocument(this.sessionId , bodymsg)
      .subscribe(data => {
        this.result=JSON.parse(JSON.stringify(data));      
      }, error => {
        this.result = JSON.stringify(error).toString();
      });  

 

 

 

Regards

Sandeep Sjhukla

 

On Tue, Oct 20, 2020 at 11:40 AM Arnaud Deman <[email protected] 
<mailto:[email protected]> > wrote:

Hello Sandeep,
Assuming the backend calls return Observables, you could do something like this 
(untested):
getSession (). pipe (
mergeMap (sessions => getInformation (session))
);

This would return an Observable of the same type as getInformation (session).

 

Regards,

Arnaud.

 

 

On Monday, 19 October 2020 at 11:35:49 UTC+2 [email protected] 
<mailto:[email protected]>  wrote:

Hi,

 

I would like to call an service in which I need a session value. I dont want 
customer to enter the login details to create the session rather on page load 
itself I would like to provide the details.

 

1)  var session =  getSession();  // rest call from backend

 

 2) var info = getInformation (session) ; //rest call from backend

 

 3) return infor to cleint

 

 I would like to know how I can do it with one call. It does not work for me.

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected] <mailto:[email protected]> .
To view this discussion on the web visit 
https://groups.google.com/d/msgid/angular/d2ffc870-f1cd-4f18-96ca-357bccb163ccn%40googlegroups.com
 
<https://groups.google.com/d/msgid/angular/d2ffc870-f1cd-4f18-96ca-357bccb163ccn%40googlegroups.com?utm_medium=email&utm_source=footer>
 .



-- 

Regards
Sandeep Shukla,
Mobile# +31647969951 <tel:+31%206%2047969951> 

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected] 
<mailto:[email protected]> .
To view this discussion on the web visit 
https://groups.google.com/d/msgid/angular/1dd27fe0-8a7e-41b1-9cc5-5a79a09a492fn%40googlegroups.com
 
<https://groups.google.com/d/msgid/angular/1dd27fe0-8a7e-41b1-9cc5-5a79a09a492fn%40googlegroups.com?utm_medium=email&utm_source=footer>
 .

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/angular/072301d6aae7%242d85d080%2488917180%24%40gmail.com.

Attachment: mongo_data.rar
Description: Binary data

Reply via email to