$scope.setFocus() should probably be outside this function.  Let's move it to the controller.