title: Why this $apply in directive is throwing value undefined error
body: <p>I'm trying write a directive using angular js, in which a button click has to increment a <code>count</code> value.</p>
  
  <p>On the click event handler I'm trying to increment the value using the <code>scope.$apply</code> construct but it is throwing an <code>Syntax Error: Token 'undefined' not a primary expression at column NaN of the expression [count++] starting at [count++]</code> error in the console.</p>
  
  <p>markup</p>
  
  <pre><code>&lt;div ng-app="myApp"&gt;
      &lt;div ng-controller="MainCtrl"&gt;
          &lt;div my-directive &gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>JS</p>
  
  <pre><code>var myApp = angular.module('myApp', []);
  
  myApp.directive('myDirective', function(){
      return {
          scope: {},
          template: '&lt;div&gt;{{count}}&lt;/div&gt;&lt;input type="button" class="increment" value="Increment" /&gt;',
          link: function(scope, iElement, iAttrs, controller) {
              console.log('link', scope.count)
              iElement.on('click', '.increment', function(){
                  console.log('click', scope.count);
                  scope.$apply('count++');
              })
          },
          controller: function($scope){
              console.log('controller')
              $scope.count = 0;
          }
      };
  });
  
  myApp.controller('MainCtrl', ['$scope', function($scope){
  }]);
  </code></pre>
  
  <p>Demo: <a href="http://jsfiddle.net/arunpjohny/3gNus/" rel="nofollow">Fiddle</a></p>