I am having an issue with URLSearchParams class with Angular 4. I try to decompose a url with two parameters:
我在使用Angular 4的URLSearchParams类时遇到问题。我尝试使用两个参数分解url:
http://localhost:4200/api/actions?uuid=63ieEB&action=signatureBlockClicked
This is what I'm doing in my class:
这就是我在课堂上所做的事情:
export default class MockActionResponse {
static dispatcher(url, pageModules, ngRedux) {
const params = new URLSearchParams(url);
const action = params.get('action');
const uuid = params.get('uuid');
……………
But the first parameter after the interogation point is null
, because URLSearchParams
analyze the url this way.
但是interogation point之后的第一个参数是null,因为URLSearchParams以这种方式分析url。
1 个解决方案
#1
0
Answer was given to me by @ankit_Saroch. I just passed the parameters without the base url!
答案是由@ankit_Saroch给我的。我刚刚传递了没有基本网址的参数!
#1
0
Answer was given to me by @ankit_Saroch. I just passed the parameters without the base url!
答案是由@ankit_Saroch给我的。我刚刚传递了没有基本网址的参数!