doc leo
doc leo

Reputation: 80

Angular 4 error "Expected 2-3 arguments, but got 1"

I have created a code that I want to upload files

  uploadImages(fda){
  return this.http.post(this.apiUrl+"/uploadImages/"+fda)
  .map((res : Response) => res);
}

but shows the error of

ERROR in E:/MCQ/CsExamsModule - Client/src/app/services/question.service.ts (90,14): Expected 2-3 arguments, but got 1.

Upvotes: 5

Views: 11607

Answers (2)

Sachintha Hewawasam
Sachintha Hewawasam

Reputation: 851

Use {} as the second argument, like this:

return this.http.post(this.apiUrl+"/uploadImages/"+fda, {})

Upvotes: 14

Eljah
Eljah

Reputation: 5154

It is very difficult to track the reason of this kind of the error, if it is thrown by the pipe (as when you are drilling only into your custom pipe filter definition with the desired number of args, you will never thing that the compiler prefers to deal with another one already exited with another agrs). For me it was just coinciding with another already imported pipe having another number of args. And I have figured this out only being forced to change the name of my custom pipe method, as then I was finally drilled in my IDE to the initial preexisted pipe defined with the same name.

Upvotes: 0

Related Questions