Devin Dixon
Devin Dixon

Reputation: 12403

Angular Route Call Cross Domain

Weird problem I am having with Angular Route. I am trying to call templates from across a domain. Except I notice when I put the other domain in the route, it does not send the request.

To be clear, this is NOT a CORS issue, but an issue of a request never being sent at all. My code, and I am calling from example.com to example2.com:

app.config(['$routeProvider', function($routeProvider) {


    var app_url = "http://templates.example2.com/";

    $routeProvider

    // route for the home page
    .when('/', {
        templateUrl : app_url + '/pages/home',
        controller : 'mainController'
    })

    .when('/home', {
        templateUrl : app_url + '/pages/home',
        controller : 'homeController'
    })

    // route for the about page
    .when('/about', {
        templateUrl : app_url + '/pages/about',
        controller : 'aboutController'
    });
}]); 

How do I force Angular to send the request?

Upvotes: 0

Views: 487

Answers (1)

Devin Dixon
Devin Dixon

Reputation: 12403

This might be an oversight on Angular because it throws no error at all, but you have to whitelist domains because it using $sce.getTrustedResourceUrl(tpl);

https://docs.angularjs.org/api/ng/provider/$sceDelegateProvider#resourceUrlWhitelist

Upvotes: 1

Related Questions