title: How to set focus on textarea within a angular ui modal every time open the modal?
body: <p>I have a textarea within an angular ui modal, and need to set focus to it when the modal is made visible, can not be in the document load because it works only the first time open the modal.</p>
  
  <p>The modal have an animation to open, I need set focus after animation finished.</p>
  
  <p>Based on other issues researched here, I created the following directive:</p>
  
  <pre><code>.directive('focusMe', ['$timeout', focusMe]);
    function focusMe($timeout) {
      return function (scope, element) {
      scope.$watch(function () {
        $timeout(function () {
          element[0].focus();
        });
      });
    };
  };
  </code></pre>
  
  <p>But this directive always checks the focus of the textarea. As my modal has another input field, when I click on it, the focus is again changed to the textarea that is using the directive. How do I set focus <strong>only the first time</strong> that the modal is made visible?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>More information:
  The problem of always keep the focus on the textarea was resolved, in a way.</p>
  
  <p>But as my modal has a fade in animation, in IE the focus is displayed above the text box, outside, I'm having to use timeout to IE to set correctly focus. That's not very nice. Some better way?</p>