I am working on adding headers to my request for fetching templates to filter out non-AngularJS requests and return an error message for them.
It seems like the only way to achieve this is by using $http
, but I feel like it would be a waste to recreate a mechanism similar to the one provided by templateUrl
.
Below is an example of my router configuration:
siteApp.config([ '$routeProvider', '$locationProvider',
function($routeProvider, $locationProvider) {
$routeProvider.when('/user', {
controller : 'UserController',
}).when('/link', {
templateUrl : '/user/index.json'
});
$locationProvider.html5Mode(true);
} ]);
edit: I am trying to have my ZendFramework2 API detect it, but it is not recognizing the XmlHttpRequest
.