I need to send data to my service and incorporate it into a URL string. The code snippet below shows how I am obtaining the data in my constructor when the user navigates to the page:
constructor(public alertController: AlertController,
private route: ActivatedRoute,private ticket_details: TicketDetailsService) {
this.route.queryParams.subscribe((data)={
this.id=JSON.stringify(data);
alert(this.id);
});
}
Next, I am invoking a service using the following code:
tcketDetails(){
this.ticekt_details.get_ticket_details().then(ticketData ={
console.log(ticketData.data);
this.ticketData=ticketData.data;
});
}
Service Code:
private server_path = 'https://example.com/apis/tickets/ticekt_details/id';
constructor(private http: HTTP) { }
async get_ticket_details() {
return this.http.get(this.server_path, {}, {})
.then(data={
return JSON.parse(data.data);
})
.catch(error={
console.log(error.status);
});
}
After receiving the id as shown in the alert message, I am unsure of how to pass the id parameter to the server_path
variable in my service. Any guidance would be appreciated.