Imagine you have an angular js app called myApp with a controller and directive. How should you go about declaring both components?
angular.module("myApp",[])
.controller("myController"......
angular.module("myApp")
.directive("myDirective".......
OR
angular.module("myApp",[])
.directive("myDirective".......
angular.module("myApp")
.controller("myController"......
Upon reviewing the code above, one can see that in the first scenario, the angular app is defined for the controller and then retrieved for the directive. In the second case, it is defined for the directive and then retrieved for the controller.
Which approach is correct? How does one determine the right way to proceed?