title: Scope's eval returns undefined in an AngularJS directive
body: <p>Background:
  I'm trying to run a callback when something inside the code of a directive in AngularJS happen.</p>
  
  <p>Pertinent code:</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;img-cropper onselect="updateAvatarData" x="100" y="100" src="{{tempAvatar}}" id="avatarCropper"/&gt;
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>$scope.updateAvatarData = function(c){
      alert("¡¡¡Funciona!!!!");
  };
  </code></pre>
  
  <p>Directive:</p>
  
  <pre><code>&lt;&lt;more code up here&gt;&gt;
  
  link: function(scope,element, attr) {
    scope.wsId = attr.id+'WS';
    scope.pvId = attr.id+'preview';
    scope.x = attr.x;
    scope.y = attr.y;
    scope.aspectRatio = scope.x/scope.y;
    scope.previewStyle = "width:"+scope.x+"px;height:"+scope.y+"px;overflow:hidden;";
    scope.onSelectFn = scope.$eval(attr.onselect);
  
  &lt;&lt;more code down here&gt;&gt;
  </code></pre>
  
  <p>The problem is in that last line "scope.onSelectFn = scope.$eval(attr.onselect);". That "scope.$eval(attr.onselect);" returns 'undefined'. The attr.onselect works fine, it returns the name of the function typed on the 'onselect' attribute.</p>
  
  <p>I have made others directives with functions passed via attibutes with no problem, but am unable to find what I am doing wrong here.</p>
  
  <ul>
  <li>Thanks in advance</li>
  </ul>