title: AngularJS - Focusing an input element when a checkbox is clicked
body: <p>Is there a cleaner way of delegating focus to an element when a checkbox is clicked. Here's the dirty version I hacked:</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;div ng-controller="MyCtrl"&gt;
      &lt;input type="checkbox" ng-change="toggled()"&gt;
      &lt;input id="name"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>JavaScript</strong></p>
  
  <pre><code>var myApp = angular.module('myApp',[]);
  
  function MyCtrl($scope, $timeout) {
      $scope.value = "Something";
      $scope.toggled = function() {
          console.debug('toggled');
          $timeout(function() {
              $('#name').focus();
          }, 100);
      }
  }
  </code></pre>
  
  <p>JSFiddle: <a href="http://jsfiddle.net/U4jvE/8/" rel="noreferrer">http://jsfiddle.net/U4jvE/8/</a></p>