EXCEPTION: Response with status: 0 for URL: null in angular2 EXCEPTION: Response with status: 0 for URL: null in angular2 flask flask

EXCEPTION: Response with status: 0 for URL: null in angular2


I had the same error with a MEAN2 app. All I had to do was install the CORS middleware and use it with express.


Server unavailable issue, might be CORS or server went down.


Hope this will helps someone.

The problem was with resource definition. When I'm trying to connect to remote resource using angular2 http.get, I was getting following error

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at …

FIX:

As I'm using flask-restful to build remote API, below fix solved my problem

from flask_restful.utils import corsfrom flask_restful import Apiapi = Api(app, decorators=[cors.crossdomain(origin='*')])

Complete source code will be available here : inventory-manager