title: Angular DOM modification timing
body: <p>I have a Controller, 
  that change some values in the <code>"then"</code> of a barcode scanner.</p>
  
  <p>First thing it set the code, then set a <code>"disabled"</code> variable, and then focus an input.</p>
  
  <pre><code>.then(function (barcodeData) {
      // Success! Barcode data is here                     
      $scope.selectProdotto = barcodeData;
      $scope.txtDisabled = false;
      var pageElements = document.querySelectorAll('input[type=number], input[type=text], textarea');
      var first_element = pageElements[1];
      first_element.focus();
  });
  </code></pre>
  
  <p>The input that i want to focus is ;</p>
  
  <pre><code>&lt;input class='input' type='number' ng-disabled="txtDisabled" /&gt;
  </code></pre>
  
  <p>Now the problem is that the input is still disabled after i changed </p>
  
  <pre><code>$scope.txtDisabled = false;
  </code></pre>
  
  <p>so when i do <code>.focus()</code> it fail.</p>
  
  <p>After my function finish my input is correctly enabled.</p>
  
  <p><strong>So im asking when are variables applied to DOM ?
  How can i wait for the input to be ready and enabled to focus ?</strong></p>