Closed lolliuym closed 7 years ago
XMLHttpRequest cannot load file:///C:/Sites/angular/ng-restless/dist/scripts/articles/articles.json. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource. (anonymous) @ vendor.ea00f94e.js:3218
main.js
angular.module('ngRestlessApp') .controller('MainCtrl', ['$http', function($http) { var store = this; store.products = []; $http.get('scripts/articles/articles.json').success(function(data) { store.products = data; }); }]);
articles.json
[{ "name": "October 28 US Election and Early Voting Rundown", "author": "Daniel Berman", "category": "US Politics", "main-image": "../images/articles/trump-clinton.jpg", "date_created": 1477612800 }, { "name": "October 26 US Election 2016 Rundown", "author": "Daniel Berman", "category": " US Election 2016 Rundown", "main-image": "../images/articles/trump-clinton.jpg", "date_created": 1477440000 }, { "name": "October 24th US Election 2016 Rundown", "author": "Daniel Berman", "category": "US Election 2016 Rundown", "main-image": "../images/articles/trump-clinton.jpg", "date_created": 1477267200 }, { "name": "US Election Rundown October 18th 2016", "author": "Daniel Berman", "category": "US Politics", "main-image": "../images/articles/trump-clinton.jpg", "date_created": 1476748800 }]
How get me that json let to work?
this sounds like your server isnt serving the file correctly. You are running a server to test the app right? grunt serve:dist at least
grunt serve:dist
closing due to inactivity
main.js
articles.json
How get me that json let to work?