Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

171
Views
BehaviorSubject devuelve [objeto][objeto] cuando está suscrito

Estoy trabajando con una API bancaria para el pago. Lo que los bancos quieren responder es que Ban Pay JavaScript realizará una redirección HTTP en el marco superior a la URL completa. what completeUrl la url que debo darle a la API del banco para enviar su respuesta en mi app.component.ts

 this.http.post("BankEndURL",quote,).subscribe(s=>{ //here i get quote this.newpay=s; //here im passing the paymentID to my service in angular to store there,because at the end of the transaction ,if its successful i need it to show the transaction data this.dataService.setData(s); //here i send a quote to backend to give me a bankurl with payment data this.http.post("SecondBakednURL",this.newpay).subscribe(s=>{ this.payaddress= s['reDirectAuthorizationHref']; //here i open the url to redirect the user to the payment portal window.open(this.payaddress);

Aquí está el servicio que he creado:

 public sharedData = new BehaviorSubject<any>(null);

constructor() {}

 getData(){ return this.sharedData; } setData(data:any){ this.sharedData.next(data); }

y aquí está mi componente receptor, el que el banco activará una vez que la transacción sea exitosa, voy a mostrar los datos de la transacción del usuario

 constructor(private dataService:DataService) {} ngOnInit(): void { this.dataService.getData().pipe( filter(data => !!data) ).subscribe(data => { alert(data) });

pero los datos aquí devuelven nulo

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

En este caso, getSharedData() devuelve el sujeto de comportamiento en sí, por lo que lo sensato en este caso es suscribirse para recibir los datos que está emitiendo al llamar a setData .

En el componente receptor:

 ngOnInit(): void { this.dataService.getData().pipe( filter(data => !!data) ).subscribe(data => { alert(data) }); }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!