我想发送带有一些实时URL的某些参数,如Angular 8中的https://google.co.in?Id:1234&carId:127,如何发送带有URL的这些参数。
buyPolicy() {
let obj = {
Id: this.idNumber,
Dob: this.dob,
SerialNo: this.vehicleSeqNo,
MobileNo: this.mobile,
EmailId: this.email,
RefID: this.vehicleId
};
let navigationExtras: NavigationExtras = {
queryParams: { ...obj }
};
this.router.navigate(['https://google.co.in'], navigationExtras);
}
Angular路由器用于在您的应用程序内进行路由。要导航到外部URL,必须使用window.open。
const url = 'https://google.co.in?Id:1234&carId:127';
window.open(url);