javascript - 如何以角度编码 URL?
问题描述
我试图将一个以国家代码“+91”开头的手机号码编码为 %2B ..使用代码
{
this.uri = "+919658452565;
this.res = encodeURIComponent(this.uri)
}
在编码结束时得到 %2B919658452565;
但是当我在 URL 参数中传递 this.uri
const params = new URLSearchParams();
params.append('personContactPhNo', this.uri); this.baseURL= "https://sfghfhfhfghtgj.com/";
let options = new RequestOptions({ headers: headers, params: params })
this.httpClient.get(this.baseURL+'Dev', options)
我收到错误为 %252B919658452565... 帮助解决此问题
解决方案
推荐阅读
- css - Angular 7 - 材质组件 CSS 未加载
- c# - EF LINQ 使用多个值跨多个字段进行搜索,但它们都必须至少出现一次
- excel - VBA 执行一分钟,然后看似无缘无故地循环回到 with 语句
- python - Scrapy,爬取多页的动态页面
- spring-webflux - 如何使用带有 zip 可迭代的组合器
- haxe - 带有 Windows (cpp) 目标的 Haxe 列表文件返回空字符串?
- clojure - 在哪里放置 Clojure 规范?
- webpack - Laravel Mix webpack 别名 - PhpStorm
- wildfly - 如何配置 Wildfly 连接到远程 Artemis 服务器?
- json - 使用 ironPython 在 Spotfire DataTable 中显示 JSON 数组结果