title: TypeError: Cannot read property 'bind' of undefined using ng-cropper directive
body: <p>I'm receiving <code>TypeError: Cannot read property 'bind' of undefined.</code> When I attempt to load the ng-cropper directive, which is an angular binding for the cropper javascript image cropping library. I'm not entirely sure what code might be most relevant to show, but this is the top half of the directive:</p>
  
  <pre><code>angular.module('ngCropper', ['ng'])
  .directive('ngCropper', ['$q', '$parse', function($q, $parse) {
    return {
      restrict: 'A',
      scope: {
        options: '=ngCropperOptions',
        proxy: '=ngCropperProxy', // Optional.
        showEvent: '=ngCropperShow',
        hideEvent: '=ngCropperHide'
      },
      link: function(scope, element, atts) {
        var shown = false;
  
        scope.$on(scope.showEvent, function() {
          if (shown) return;
          shown = true;
  
          preprocess(scope.options, element[0])
            .then(function(options) {
              debugger;
              setProxy(element);
              element.cropper(options);
            })
        });
  
        function setProxy(element) {
          if (!scope.proxy) return;
          var setter = $parse(scope.proxy).assign;
          setter(scope.$parent, element.cropper.bind(element));
        }
  </code></pre>
  
  <p>The error is thrown on the <code>setter(scope.$parent, element.cropper.bind(element));</code> line in the <code>setProxy()</code> function.</p>
  
  <p>It's because <code>cropper</code> apparently is undefined on the element variable. What would cause this? I am not an expert in angular directives, but I would imagine it should resolve fine if the tag has been setup like this?
   </p>
  
  <p>and the strange thing is, it does resolve fine in the demo application and my code reflects the same setup! My only guess is perhaps another module I may be using could be interfering? I'm reluctant to take them all out but it might come down to that.</p>
  
  <p>My modules are declared as:
  <code>angular.module('app', [
          'ui.router',
          'ngMessages',
          'ngSanitize',
          'LocalStorageModule',
          'angular.filter',
          'flow',
          'ng-sortable',
          'focus-if',
          'ngCropper',
          'controllers', 'services', 'directives', 'filters'])</code></p>
  
  <p>I referred to this demo to get as far as I did - <a href="https://github.com/koorgoo/ngCropper/tree/master/demo" rel="nofollow">https://github.com/koorgoo/ngCropper/tree/master/demo</a></p>
  
  <p>I suppose,</p>
  
  <ol>
  <li>On what basis should 'cropper' resolve? (so I know what to check)</li>
  <li>Can you see any obvious issues with my code?</li>
  </ol>