title: Turning jQuery into Angular, fixed sidebar not working (?)
body: <p>I am converting a jQuery Plugin into an Angular Directive, but still not working properly, or: not working at all.</p>
  
  <p><a href="http://plnkr.co/edit/xRXOqzaXxg6hVXDhOfV2?p=preview" rel="nofollow">This is the behavior I want to achieve</a></p>
  
  <p><a href="http://jsfiddle.net/maketroli/2cseox3r/2/" rel="nofollow">Here is a jsfiddle also</a></p>
  
  <p>Remember that all I want to achieve with this, is the behavior on the left sidebar where says 'sticky' everywhere.</p>
  
  <p>I did it with jQuery (I am new to Angular) and I need to have it working with Angular. Please go and see the <a href="http://plnkr.co/edit/xRXOqzaXxg6hVXDhOfV2?p=preview" rel="nofollow">Plunkr Example</a>, that behavior, is the one I want. Thanks in advance if some of you guys take the time to help me.</p>
  
  <p>Look at the jQuery code:</p>
  
  <pre><code>$(function() {
      var offset = $("#sidebar").offset();
      var topPadding = 85;
      $(window).scroll(function() {
          if ($(window).scrollTop() &gt; offset.top) {
              $("#sidebar").stop().animate({
                  marginTop: $(window).scrollTop() - offset.top + topPadding
              });
          } else {
              $("#sidebar").stop().animate({
                  marginTop: 50
              });
          };
      });
  });
  </code></pre>
  
  <p>and here is my Angular Directive:</p>
  
  <pre><code>angular.module('capilleira.clickAndGambleWebApp.directives', [])
    .directive('sticky', function ($window) {
      return {
        restrict: 'A',
        controller: ($scope)
        link: function (scope, element, attrs) {
          var raw = element[0],
              offset = element.offset(),
              topPadding = 85;
  
          angular.element($window).bind('scroll', function () {
            console.log('SCROOOOOOOOOOOOOLLLL');
            if ($window.scrollTop &gt; offset.top) {
              raw.stop().animate({
                marginTop: $window.scrollTop() - offset.top + topPadding
              });
            }
          });
        }
      }
    });
  </code></pre>
  
  <p>my directive is good at the point that once you do scroll, <code>the console.log</code> shows up.</p>