title: How to resolve angular $digest error?
body: <p>I have implemented <code>emailPattern</code> method to validate specific email address , so when my modal window pops up i see below error , how to resolve <code>$digest</code> error in angularjs ?</p>
  
  <p>main.html</p>
  
  <pre><code>&lt;md-input-container flex="100"&gt;
              &lt;label&gt;Cc&lt;/label&gt;
              &lt;md-chips ng-model="notifyCtrl.cc" name="email"
                        md-separator-keys="customKeys"
                        md-transform-chip="addChips($chip)"
                        md-add-on-blur='true'
                        ng-pattern="emailPattern($chip)"
                        name="email"&gt;
              &lt;/md-chips&gt;
              &lt;div class="help-block" ng-messages="notifyForm.email.$error" ng-show="notifyForm.email.$touched &amp;&amp; notifyForm.email.$invalid"&gt;
                  &lt;div ng-message="pattern"&gt;An email must contain a-z, A-Z, 0-9, or _ characters.&lt;/div&gt;
              &lt;/div&gt;
            &lt;/md-input-container&gt;
  </code></pre>
  
  <p>Ctrl.js</p>
  
  <pre><code>$scope.emailPattern = function(elementValue){
           var emailPattern = /^[a-z]{2}[0-9]{3}[a-z0-9]+@[a-zA-Z0-9.]+\.[a-zA-Z]{2,4}$/;
           console.log(emailPattern.test(elementValue));
           return emailPattern;
         }
  </code></pre>
  
  <p>Error</p>
  
  <pre><code>Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
  Watchers fired in the last 5 iterations: [[{"msg":"emailPattern($chip)","newVal":{},"oldVal":{}}],[{"msg":"emailPattern($chip)","newVal":{},"oldVal":"..."}],[{"msg":"emailPattern($chip)","newVal":{},"oldVal":"..."}],[{"msg":"emailPattern($chip)","newVal":{},"oldVal":"..."}],[{"msg":"emailPattern($chip)","newVal":{},"oldVal":"..."}]]
  </code></pre>