title: How to move scrollIntoView into angular directive
body: <p>See my code snippets:</p>
  
  <p>Directive <code>node</code>:</p>
  
  <pre><code>myModule.directive ('node', ['$compile', function ($compile) {
  return {
      restrict: 'A',
      link: function (scope, element, attrs) {
          var node = scope.node;
          node.scrollTarget = element;
          // ...
      }
  });
  </code></pre>
  
  <p>Function <code>scroll</code></p>
  
  <pre><code>$scope.scroll = function (node) {
          $scope.showTree (node);
          $timeout (function () {
              node.scrollTarget[0].scrollIntoView ();
          }, 0, false);
      };
  </code></pre>
  
  <p><code>scroll</code> is invoked per <code>ng-click=scroll(node)</code> and changes the model (<code>showTree</code>) as well as does some dom-manipulation (<code>scrollIntoView</code>).
  It is said that dom-manipulations should be avoided in controllers. How can I write it better?</p>