我正在使用角度CLI。
如何删除令牌参数名称和值?
let params = new HttpParams();
params = params.append('siteId', 1);
params = params.append('orgId', 2);
params = params.append('token', 3);
到目前为止,这是我的代码:
validate(email) {
let params = new HttpParams();
params = params.set('email', email);
params = params.set('siteId', this._global.SITEID);
params = params.set('orgId', this._global.ORGID);
params = params.set('domainName', this._global.DOMAIN_NAME);
params = params.set('token', this._global.getRandomUuid());
params.delete('domainName',this._global.DOMAIN_NAME);
return this.api.call('member/duplicate', params);
}
call(url, params) {
// here I want to delete the token param name and value.
}
答案 0 :(得分:0)
Sumama答案是正确的,在给定request和params变量的情况下,以下代码应该可以正常工作,以便cloneRequest不会具有已删除的参数。
let newParams = request.params.delete('parameter-name');
let clonedRequest = request.clone({ params: newParams });