Angular 2 Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header
That's a CORS issue. It happens because you are trying to request a resource from a different host. Your API needs to answer those OPTIONS requests properly otherwise the browser is going to block the request.
https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
CORS protection isn't implemented in postman so your request works fine there.
Edit: You can also use webpack / angular cli's proxy support if your backend is going to run on the same host in production:
https://github.com/angular/angular-cli/blob/master/docs/documentation/stories/proxy.md
Response to preflight request doesn't pass access control check: It does not have HTTP ok status in angular
CORS should be server-side issue, not Angular.
Anw just for development purposes you can open Chrome with the option --disable-web-security. You can check the ref here: Disable same origin policy in Chrome
Angular2-Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource
CORS headers like
headers.append('Access-Control-Allow-Origin','*');
need to be provided by the server. Adding them on the client is pointless.
Related Topics
How to Automatically Increment Numbers in C#
Programmatically Create and Launch and Rdp Session (Without Gui)
Response to Preflight Request Doesn't Pass Access Control Check (Angular2)
C# - How to Save Byte Values to File With Smallest Size Possible
Accessing a Shared File (Unc) from a Remote, Non-Trusted Domain With Credentials
Reading Only Specific Columns from a CSV File Out of Many
Compare Two Objects' Properties to Find Differences
How to Send a File Document to the Printer and Have It Print
How to Get the Specific Column in Excel Worksheet Using Documentformat.Openxml C#
How to Implement Async Task to Fetch Data from Database Using Async and Await
How to Autosize the Height and the Width of C# Windows Form
Getting All Attributes from an Iwebelement With Selenium Webdriver
How to Set the Content-Type Header for an Httpclient Request
Can Newtonsoft Json.Net Skip Serializing Empty Lists
Where Is the Postasjsonasync Method in ASP.NET Core