alternative way to define controller and directive