Often directives have controllers, and in this instance, instead of defining the controller inside the directive, one can define it outside the directive and test the functionality easier. I did a similar thing with alch-table. I believe the two are tied together for the directive to work as intended. I could switch the order of appearance of the controller and directive declarations to ensure clarity of what the entity is supposed to be.