我想用一些实时URL发送一些参数,例如Angular 8中的https://google.co.in?Id:1234&carId:127我如何通过URL发送这些参数

问题描述 投票:0回答:1

我想发送带有一些实时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);
    }
routing angular-routing angular8 url-parameters
1个回答
0
投票

Angular路由器用于在您的应用程序内进行路由。要导航到外部URL,必须使用window.open

const url = 'https://google.co.in?Id:1234&carId:127';
window.open(url);
© www.soinside.com 2019 - 2024. All rights reserved.