When it comes to defining a route with a template, there are two main ways to set the controller for the view:
In the route:
$routeProvider .when('/phone/:phoneId', { controller: 'PhoneDetailController', templateUrl: 'phone.detail.html', } });
In the template:
$routeProvider .when('/phone/:phoneId', { templateUrl: 'phone.detail.html', } });
<div ng-controller="PhoneDetailController"> <!-- [...] --> </div>
What are the distinctions between these methods, which one is the preferred choice, and what are the reasons behind that recommendation?