This doesn't work of course, but should explain what I want to achieve:
In the factory "myapp.factory('gameService', function($http, $location) {" I load data from json feed "return $http.jsonp('api/game/' + id + '?callback=JSON_CALLBACK')", if the data is not loaded change the templateURL, which was loaded in at first, to 404 page url instead.
var get_data = function (id) {
return $http.jsonp('api/game/' + id + '?callback=JSON_CALLBACK')
.then(function(response) {
//data loaded, do magic
}, function(response) {
//data not loaded
templateUrl: 'views/page_not_found.html'; //<- how to inject this so it works?
});
};