1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| .service('Syncservice', function () { function fetch(url) { var request; if (window.XMLHttpRequest) { request = new XMLHttpRequest(); } else if (window.ActiveXObject) { request = new ActiveXObject("Microsoft.XMLHTTP"); } else { throw new Error("Your browser don't support XMLHttpRequest"); } request.open('GET', url, false); request.send(null);
if (request.status === 200) { return request.responseText; } } return { fetch: fetch } });
|