Reputation: 91
I have a route provider defined:
$routeProvider.when('/interview', {
controller: 'Interview',
templateUrl: function(parms) {
return parms.target + '/partials/Interview.html';
}
});
But I get the following exception:
Uncaught TypeError: Object function (parms) {
return 'partials/Interview.html';
} has no method 'match'
With breakpoints, I found that AngularJS thinks my function is an URL.
Completely confused.
Upvotes: 1
Views: 983
Reputation: 14203
You're probably using an the stable version (1.0.8) of angular which doesn't allow for templateUrl
to be a function. You should give it a shot with the latest release candidate, 1.2-rc3.
templateUrl – {string=} – path to an html template that should be used by ngView.
templateUrl – {string=|function()=} – path or function that returns a path to an html template that should be used by ngView.
If templateUrl is a function, it will be called with the following parameters:
{Array.} - route parameters extracted from the current $location.path() by applying the current route
Upvotes: 1