title: Lots of TypeError: fnPtr is not a function in angularJs
body: <p>I am currently extending an angularjs application which was created by someone else and i am running into problems after building it with grunt. Even though the site does work i am getting a lot of <code>TypeError: fnPtr is not a function</code> errors in the console. The error stack is not really helpful, but i managed to find two distinct spots inside my application which are named inside those stacks:</p>
  
  <ol>
  <li><p>The first one is a workaround for this bug: <a href="https://github.com/angular/angular.js/issues/2621" rel="nofollow">https://github.com/angular/angular.js/issues/2621</a>. I do believe that this is actually no longer needed (since we are using angular 1.2.6 and as far as i can tell this bug seems to be fixed for this version). Here is the relevant bit:</p>
  
  <pre><code>ScopePrototype.$watchCollection = function(obj, listener) {
              var self = this;
              var oldValue;
              var newValue;
              var changeFlipFlop = 0;
              var objGetter = $parse(obj);
              var internalArray = [];
              var internalObject = {};
              var internalLength = 0;
  
              var internalValue = initWatchVal;
  
              function $watchCollectionWatch() {
                  var newLength, key, i, changeDetected;
  
                  newValue = objGetter(self);
                  ....}
  </code></pre>
  
  <p>The error points to: <code>newValue = objGetter(self);</code> at some point. Even if i remove this workaround from my code the same spot inside the angular.js file gets named, which does look like this (snippet):</p>
  
  <pre><code>$watchCollection: function(obj, listener) {
      var self = this;
      var oldValue;
      var newValue;
      var changeDetected = 0;
      var objGetter = $parse(obj);
      var internalArray = [];
      var internalObject = {};
      var oldLength = 0;
  
      function $watchCollectionWatch() {
        newValue = objGetter(self);
        var newLength, key;
  </code></pre></li>
  <li><p>The second occurrence is even stranger (points to <code>doCheck</code>). This is just a simple directive:</p>
  
  <pre><code>return {
      restrict: 'A',
      scope: {
          showLeft: '=',
          showRight: '='
      },
      controller: function ($scope) {
          $scope.checkVisibility = function(scrollPosition, elementWidth){
              if(scrollPosition &lt;= 0) {
                  $scope.showLeft = false;
              } else {
                  $scope.showLeft = true;
              }
              if(scrollPosition &gt;= elementWidth) {
                  $scope.showRight = false;
              } else {
                  $scope.showRight = true;
              }
  
              if(!$scope.$parent.$$phase) { // Prevent digest error
                  $scope.$apply();
              }
          };
      },
  link: function($scope, $element, $attr) {
          var doCheck = function(){
              $scope.checkVisibility($element[0].scrollLeft, $element[0].scrollWidth - $element[0].offsetWidth - $attr.rightScrollOffset);
  
          };
  
          angular.element($element).scroll(function(){
              doCheck();
          });
  
          /* use timeout, as $element[0].children[0].offsetWidth is not being ready now */
          $timeout(function(){
              doCheck();
          }, 200);
  
          /* also set on resize */
          angular.element($window).bind('resize',function(){
              doCheck();
          });
  
          /* also set on dom node changes of scroll Div */
          angular.element($element).bind('DOMNodeInserted DOMNodeRemoved', function(event) {
              doCheck();
          });
      }
  </code></pre></li>
  </ol>
  
  <p>All vendor js files are getting "compiled" into one vendor.js file. The strange thing is that it does work without problems when i use an older version of this compiled vendor.js. I already tried to diff both files to see if any versions do mismatch, but i couldn't find anything critical. Anyone any ideas what might happen here? It also happens when i skip the building process and just use each .js file on its own.</p>