In the following code:
phonecatApp.config(['$routeProvider',
function($routeProvider) {
$routeProvider.
when('/phones', {
templateUrl: 'partials/phone-list.html',
controller: 'PhoneListCtrl'
}).
when('/phones/:phoneId', {
templateUrl: 'partials/phone-detail.html',
controller: 'PhoneDetailCtrl'
}).
otherwise({
redirectTo: '/phones'
});
}]);
Is it possible to somehow get the value "phoneId" in the url template, for example, something like this (I know that it does not work, but it explains what I ask):
when('/phones/:phoneId', {
templateUrl: 'partials/' + $routeParams.phoneId + '.html',
controller: 'PhoneDetailCtrl'
}).
The goal is to load an HTML file called phoneId.
source
share