title: Inject $state or $stateParams into directive not possible with angular ui router
body: <p>When I inject $state/$stateParams into the directive they are not available inside the unique function, why?</p>
  
  <pre><code>'use strict';
  angular.module('TGB').directive('uniqueSchoolclassnumberValidator', function (schoolclassCodeService) {
      return {
          restrict: 'A',
          require: 'ngModel',
          link: function (scope, element, attrs, ngModel) {
              ngModel.$asyncValidators.unique = function (schoolclassNumer) {
  
                  var schoolyearId = 1; // Read schoolyearId from the $stateParams.id but how to inject?
                  return schoolclassCodeService.exists(schoolyearId, schoolclassNumber);
              };
          }
      };
  });
  </code></pre>
  
  <p>UPDATE</p>
  
  <p><a href="https://i.stack.imgur.com/tY4PW.png"><img src="https://i.stack.imgur.com/tY4PW.png" alt="enter image description here"></a></p>
  
  <p>As you see in my google chrome console $stateParams or $state are undefined!</p>