Issue:
Having trouble with Ionic's http get function, as I keep running into this error message:
Typescript Error
Expected 1-2 arguments, but got 3.
The line causing the problem seems to be similar to this:
this.http.get('http://127.0.0.1:8000/rest-api/', {}, {headers: headers})
Based on the documentation, it looks like my usage is correct, right?
EDIT: I even tried using Ionic's example get() usage in my project and still encountered the same error.
https://i.sstatic.net/BM35Z.png
Possible Solutions:
I have discovered that these steps sometimes resolve the specific error mentioned above:
- Make random changes to the project, save, and then rerun 'ionic serve'
- Check if the CORS plugin on the web browser is enabled
- Ensure there are no other errors in the project (such as mis-aligned {}'s)
Query:
The unpredictable fixes are worrisome, so I'm wondering if anyone knows what could potentially trigger this behavior in an Ionic project?