-- 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 : '');