I want to be able to specify the controller that a directive uses by adding an attribute to the element - in other words, dynamically:
HTML
<div data-mydirective data-ctrl="DynamicController"></div>
Angular
angular.module('app', [])
.controller('MainController', [function() { ... }])
.controller('DynamicController', [function() { ... }])
.directive('mydirective', [function() {
return {
controller: 'DynamicController', // <- this should be dynamic
...
}
}]);