Rewrite controller using angular.element