I want add to add some headers to the requests for fetching templates so I can reject non-angularjs requests and respond with an error.
However it seems that it's only possible using $http
and it seems like terrible waste to reimplement a mechanism similar to the one templateUrl
provides.
Here's my sample router:
siteApp.config([ '$routeProvider', '$locationProvider',
function($routeProvider, $locationProvider) {
$routeProvider.when('/user', {
controller : 'UserController',
}).when('/link', {
templateUrl : '/user/index.json'
});
$locationProvider.html5Mode(true);
} ]);
edit: if it helps, I'm trying to get my ZendFramework2 API to detect it, but it fails to recognize the XmlHttpRequest