refactor directives' controller instance creation to use js constructor