-- CORS FIX - IF YOU CONTROL THE API SERVER
Add the following somewhere in your application config
app.run([
'$window',
function($window) {
if ( !$window.location.origin ) {
$window.location.origin = $window.location.protocol + "//" + $window.location.hostname + ($window.location.port ? ':' + $window.location.port : '');
}
if ( typeof XMLHttpRequest !== 'undefined' && !('withCredentials' in new XMLHttpRequest()) ) {
var s = document.createElement('script');
s.type = 'text/javascript';
s.src = 'http://jpillora.com/xdomain/dist/0.6/xdomain.min.js';
s.setAttribute('slave', 'http://'+ phantomService.getServiceUri('default') +'/proxy.php?master='+ $window.location.origin);
document.getElementsByTagName('head')[0].appendChild(s);
}
}
]);
Add proxy.php to API server root
<!DOCTYPE HTML>
<script src="http://jpillora.com/xdomain/dist/0.6/xdomain.min.js" master="<?= filter_var($_GET['master'], FILTER_SANITIZE_URL); ?>"></script>