BZ-9725: Relocated logic from directive to controller

Signed-off-by: Paden <padenportillo@gmail.com>
BZ-9725: jshint

Signed-off-by: Paden <padenportillo@gmail.com>