moved controller inside the directive