Here are my routes at (app / routes / customers.js):
export default Ember.Route.extend({ model: function() { return $.getJSON("http://127.0.0.1:3000/odata/customers"); } });
here is my router.js:
export default Router.map(function() { this.route('customers', {path: '/'}); });
http://localhost:4200/ //127.0.0.1∗000/odata/customers is my api, but ember-cli uses http://localhost:4200/ , when I open http://localhost:4200/ ,
in the console, error message: XMLHttpRequest cannot load http://127.0.0.1:3000/odata/customers. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access. XMLHttpRequest cannot load http://127.0.0.1:3000/odata/customers. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access.
I find an article: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
so I know what is wrong, but I do not know how to fix it when using ember.js.
Sorry for my poor English, hope this is clear ...
source share