Ionic object change/convert entries


#1

i have a object

this.requestData = {
      flightto: CGK,
      flightfrom: DPS,
      flightdate: 06-04-2018,
      flightpp: 0,
      flightadult: 1,
    };
    console.log((<any>Object).entries(this.requestData));

if I do console.log () how do I make this object out to be

flightto=CGK&flightfrom=DPS&flightdate=06-04-2018&flightpp=0&flightadult=1


#2

Your question is confusing, but perhaps HttpParams is what you are looking for.


#3

I get an error

Uncaught Error: Can’t resolve all parameters for HttpParams: (?).
at syntaxError (compiler.js:466)
at CompileMetadataResolver._getDependenciesMetadata (compiler.js:15547)
at CompileMetadataResolver._getTypeMetadata (compiler.js:15382)
at CompileMetadataResolver._getInjectableMetadata (compiler.js:15362)
at CompileMetadataResolver.getProviderMetadata (compiler.js:15722)
at compiler.js:15633
at Array.forEach ()
at CompileMetadataResolver._getProvidersMetadata (compiler.js:15593)
at CompileMetadataResolver.getNgModuleMetadata (compiler.js:15161)
at JitCompiler._loadModules (compiler.js:33542)


#4

You don’t inject it. Read the documentation.