我想在Angular 8中发送一些带有实时URL的参数

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

我想发送一些带有实时网址的参数,例如Link。我该如何使用网址发送这些参数。

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.