Answer the question
In order to leave comments, you need to log in
I don’t fully understand what the when ngRoute router does, does it redirect?
I'm just learning Angular.
But I don't understand what when does
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'
});
}]);
<a href="xxx.localhost/phones"></a>
, I go to the page as usual, and if the controller is not specified on it, then angular does not process. Answer the question
In order to leave comments, you need to log in
If the url is not in the when list, the code will work
otherwise({
redirectTo: '/phones'
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question