I want to take an angular application that works fine on my own domain and 'embed' it into several other sites.
The app uses partials with the ng_view directive so that the only thing i need to do to 'inject' my app into one of my pages is...
<div ng-app="myapp" ng-view></div>
My app looks like this...
angular.module('myapp', ['myapp.filters', 'myapp.services', 'myapp.directives', 'ui']).
config(['$routeProvider', function($routeProvider) {
$routeProvider.otherwise({templateUrl: 'partials/mainTemplate.html', controller: myController});
}]);
this works fine, but when I try to 'inject' the app into another site, In addition to externalizing the script references, I changed the app to look like this...
angular.module('myapp', ['myapp.filters', 'myapp.services', 'myapp.directives', 'ui']).
config(['$routeProvider', function($routeProvider) {
$routeProvider.otherwise({templateUrl: ''http://mydomain.com/partials/mainTemplate.html', controller: myController});
}]);
But it doesn't work... no errors, no nothing, it just doesn't render my app.
Any ideas? are external partial references allowed?... is the browser being over-protective? Should I take a completely different approach??
I think you should enable CORS on mydomain.com in order to get the view. And, as bUKaneer says, you have to add mydomain.com in the $sceDelegateProvider.resourceUrlWhitelist