You are trying to do an AJAX ($http.get) call from a different host/domain/IP. My guess is that you're running your Angular app on http://localhost
or http://127.0.0.1
and you're running Node on http://127.0.0.1:9000
, which is a different Origin. There are two solutions:
- Run them on the same hostname, for example both on localhost or both 127.0.0.1.
- Add an Access-Control-Allow-Origin HTTP header from Node, allowing your Angular host (origin) to access the back end via AJAX.
The reason for all this is a security measure, so that websites cannot just fetch any other website on the internet without explicit permission. Otherwise malicious websites could do an AJAX call to your PayPal or bank account for example.