I am trying to route the data from service to a component using the following codes. It shows me error
"Property 'route' does not exist on type 'typeof PaymentService'.ts"
"Declare static property route"
import { Injectable } from '@angular/core';
import { environment } from 'src/environments/environment';
import { Router} from '@angular/router';
@Injectable({
providedIn: 'root',
})
export class PaymentService {
constructor(private route:Router) { }
static verifyPayment(payload: any) {
const axios = require('axios');
let data = {
'token': payload.token,
'amount': payload.amount,
};
axios.post(environment.api_url+"set_appointment_with_payment", data)
.then(response => {
if(response.data.paymentStatus=== "Completed"){
this.route.navigate('/Bill');
}else{
alert('Something went wrong! Please try again.');
}
})
.catch(error => {
console.log(error);
});
}
}