url - Weird issue with URLSearchParams() in Angular2 -


i have weird issue appears urlsearchparams() works when defining var search (i.e if change variable name var othername) not work!!

however, reason works when name search !! totally not logical @ all.

any idea on what's happening here?

  constructor(http) {   this.http = http;   this.genre = null;   this.dishes = null;    //this 1 works fine   var search = new urlsearchparams();   search.set('order', '-ordersno');    //here issue (to make work, need remove previous search declaration, , rename below var limit search)   var limit = new urlsearchparams();   limit.set('limit', '2');    this.http.get('https://example.com/classes/mn', { limit }).subscribe(data => {   this.dishes = data.json().results;   });     this.http.get('https://example.com/classes/genre',{ search }).subscribe(data => {   this.genre = data.json().results;   }); 

i guess want have this:

{ search: search }  //and   { search: limit } 

options parameter of http method must have following signature:

export interface requestoptionsargs {     url?: string;     method?: string | requestmethod;     search?: string | urlsearchparams;     headers?: headers;     body?: string; } 

but {limit } same { limit: limit }.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -