I'm wondering what the use cases are for these two methods of creating a controller:
Using ngController:
myApp.controller('myController', ['$scope', function ( $scope ) {
}]);
Constructing the controller within a directive with the controller attribute:
myApp.directive ( 'myDirective', [ '$window', function( $window ) {
return {
restrict: 'A',
controller: [ '$scope', function( $scope ) {
}],
link: function( scope, element, attrs ) {
}
};
}]);
Is there any reason you wouldn't construct the controller within a directive if they were both invoked on the same element?
Is it simply a question of how widely used / complex the controller is?
Constructing the controller within, from scratch or from empty controller?