How I add Headers to http.get or http.post in Typescript and angular 2?

You can define a Headers object with a dictionary of HTTP key/value pairs, and then pass it in as an argument to http.get() and http.post() like this: const headerDict = { ‘Content-Type’: ‘application/json’, ‘Accept’: ‘application/json’, ‘Access-Control-Allow-Headers’: ‘Content-Type’, } const requestOptions = { headers: new Headers(headerDict), }; return this.http.get(this.heroesUrl, requestOptions) Or, if it’s a POST request: … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)