Error: Can't resolve all parameters for HttpHeaders: (?). at syntaxError (http://localhost:8100/build/vendor.js)


#1

I’m able to call my post API using postman by passing param using ‘x-www-form-urlencoded section’ method.

now getting error while compile my Ionic 3 app with below details:

import { Component, Injectable } from ‘@angular/core’;
import { NavController } from ‘ionic-angular’;
import { HttpClient,HttpHeaders, HttpParams, HttpClientModule } from ‘@angular/common/http’;

values=’’;
onKeydown(event: any) {
this.values = event.target.value;
let body = { stext: this.values };
let headers = new HttpHeaders();
headers.append(‘Content-Type’, ‘x-www-form-urlencoded’);
this.http.post(‘xxxxxxxxxxx/apui/v1/action’,body, {headers: headers})
.subscribe(res => {
}, (err) => {
console.log(err);
});
}

Please help me… Below is ionic info:

Ionic Framework:3.9.2
Ionic App Scripts:3.1.9
Angular core:5.2.10
Angular Compiler CLI: 5.2.10
Node:8.11.1
OS Platform: Windows 10
Navigator Platform: Win32


Error "Can't resolve all parameters for provider"
#2

Show us the error to get help


#3

@izio38 This is the error I’m getting:

Can’t resolve all parameters for HttpHeaders: (?).
at syntaxError (http://localhost:8100/build/vendor.js:77975:34)
at CompileMetadataResolver._getDependenciesMetadata (http://localhost:8100/build/vendor.js:93195:35)
at CompileMetadataResolver._getTypeMetadata (http://localhost:8100/build/vendor.js:93030:26)
at CompileMetadataResolver._getInjectableMetadata (http://localhost:8100/build/vendor.js:93010:21)
at CompileMetadataResolver.getProviderMetadata (http://localhost:8100/build/vendor.js:93370:40)
at http://localhost:8100/build/vendor.js:93281:49
at Array.forEach ()
at CompileMetadataResolver._getProvidersMetadata (http://localhost:8100/build/vendor.js:93241:19)
at CompileMetadataResolver.getNgModuleMetadata (http://localhost:8100/build/vendor.js:92809:50)
at JitCompiler._loadModules (http://localhost:8100/build/vendor.js:111902:87)


#4

Worked for me!