title: How do I get multiple input values in the same directive?
body: <p>EDIT: Below is the working example for anyone looking. I have live validation on the promoCode with the directive that takes in 2 input values.</p>
  
  <p>Hello I'm stuck on a problem. I have 2 inputs, an email and a promo code and one directive that checks if the promo code and associated email are valid. However I am stuck in how to pass in the email value as well. I've got it half way where I am able to check the promo code with a hardcoded email value. Am I going to have to rewrite how I do this check or am I missing something obvious to get the email value? Is this even a right approach? I am new to Angular.</p>
  
  <p>To clarify: The API call happens when the user starts typing in a promo code. Basically how do I grab the email value and send it along to the factory? I've looked and tried scope.$watch and was able to see the values changing for each input but was unable to store it.</p>
  
  <p>I have looked here <a href="https://stackoverflow.com/questions/12371159/how-to-get-evaluated-attributes-inside-a-custom-directive?rq=1">How to get evaluated attributes inside a custom directive</a> and tried that approach but was getting "undefined" for email and promocode values.</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;input type="text" class="form-control" name="email" id="email" placeholder="Enter Email" maxlength="254" ng-model="registrationData.email" required &gt;
  &lt;input type="text" class="form-control" name="promoCode" id="promo-code" placeholder="Parking Program Code" ng-model="registrationData.promo_code" ng-model-options="{ debounce: 500 }" promo-email='registrationData.email' promo-validation&gt;
  &lt;div ng-show="validate.promoCode.$touched || validate.promoCode.$dirty"&gt;
    &lt;div ng-messages="validate.promoCode.$error" style="color:maroon" role="alert"&gt;
    &lt;div ng-message="promoCode"&gt;Code invalid&lt;/div&gt;
  &lt;/div&gt;
  &lt;div ng-messages="validate.promoCode.$pending"&gt;
    &lt;div ng-message="promoCode"&gt;Checking promo test...&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>Directive</p>
  
  <pre><code>.directive('promoValidation',['isPromoValid', function(isPromoValid)
  { 
    return {
    restrict: 'A',
    require: 'ngModel',
    scope: 
    { 
        promoEmail:'=' 
    },
    link: function(scope, element, attrs, ngModel) {
    element.bind('focus', function() {
      ngModel.$asyncValidators.promoCode = function(promoCode) {
        return isPromoValid(scope.promoEmail, promoCode);
     })
     }
    }}
  ]);
  </code></pre>
  
  <p>Factory</p>
  
  <pre><code>.factory('isPromoValid',['$q', '$http', 'SERVICE_BASE', function($q, $http, SERVICE_BASE) {
  var apiUrl = SERVICE_BASE + '/users/ValidatePromoCode';
  return function(email, promoCode) {
  var deferred = $q.defer();
  if(!promoCode)
  {
    deferred.resolve(); //promoCode is optional so I have this check if the user adds a promoCode then deletes it. It removes the error message
  }
  else {
    $http.get(apiUrl , {params: { promo_code: promoCode, email: email }}).then(function validPromo(data){
    var isPromoValid = data.data.data.valid;
    if(isPromoValid) {
      deferred.resolve();
    }
    else {
      deferred.reject();
    }
  });
     }
      return deferred.promise;
    };
  }]);
  </code></pre>