title: Angular model not updating - Angular.js
body: <p>I have a directive where the model is not updating like I think it is supposed to.  Here is my html:</p>
  
  <pre><code>      &lt;div class="text-area-container"&gt;
          &lt;textarea ng-model="chatText" ng-keyup="updateCount(chatText)"&gt;&lt;/textarea&gt;
        &lt;/div&gt;
       &lt;input ng-disabled="disableCommentButton()" value="Comment" ng-click="addMessage(chatText)"/&gt;
  </code></pre>
  
  <p>As you can see I have a <code>ng-model</code> attached to the <code>&lt;textarea&gt;</code>.  I don't know if this affects anything, but I also have a <code>ng-keyup</code> attached to the element, that takes the model and looks at how many characters are in it.  The last piece is I have a <code>ng-disable</code> on an input that is evaluated by a function.  Here is my the <code>link</code> function of my directive:</p>
  
  <pre><code>  link: function(scope) {
      scope.chatText = '';
  
      scope.countRemaining = 500;
  
      scope.updateCount = function(chatText) {
        scope.chatText = chatText;
        scope.countRemaining = scope.maxChatCount - chatText.length;
      };
  
      scope.disableCommentButton = function() {
        return _.isUndefined(scope.encounter) || _.isEmpty(scope.chatText);
      };
    }
  </code></pre>
  
  <p>The problem is that my <code>scope.chatText</code> is always undefined in the <code>disableCommentButton</code> method.  I thought that by attaching a model to an element in the <code>html</code>, the I would have access to it on the scope.  What am I missing here?</p>