简体   繁体   English

如何在Angular 6中获取特定的网址模式

[英]How to get specific Url pattern in Angular 6

I would like to get a specific URL pattern. 我想要一个特定的URL模式。 The sample is given below: 示例如下:

localhost/reports/orderproducts?filter=1&from=01.10.2018&to=31.10.2018&admins=45%2C32%2C43&product=0&categories=5%2C2 本地主机/报告/ orderproducts?滤波器= 1&从2018年10月1日=&到= 2018年10月31日&管理员= 45%2C32%2C43&产品= 0&类别= 5%2C2

Right now I am getting: 现在我得到:

localhost/reports/orderproducts?filter=1&from=01.10.2018&to=31.10.2018&admins=45&admins=32&admins=43&product=0&categories=5&categories=2 本地主机/报告/ orderproducts?滤波器= 1&从2018年1月10日=&到= 2018年10月31日&管理员= 45&管理员= 32&管理员= 43&产品= 0&类别= 5&类别= 2

    submitFiltration(form: NgForm) : void {
      let params : Object = MiscUtils.filterObject(this.formData);
      params['filter'] = 1;
      this.router.navigate([], {queryParams: params});
      this.submitted.emit(this.formData);
    }

param object 参数对象

Any help is appreciated. 任何帮助表示赞赏。 The best help would be to help me to understand the approach. 最好的帮助是帮助我理解该方法。 Thanks in advance 提前致谢

You are trying to show as URL Encoded string fo example in you admins=45%2C32%2 actualy is admins=45,32,43 if you want to show it like this you must add the array with a join(',') to you get split it by coma. 您试图以admins=45%2C32%2示例形式显示为URL编码的字符串。 admins=45,32,43 ,您是admins=45,32,43如果要这样显示,则必须添加带有join(',')的数组你会被昏迷分开。

Example: 例:

let stringParam = adminsArray.join(','); 让stringParam = adminsArray.join(',');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM