When I insert $ state / $ stateParams into a directive, they are not available inside a unique function, why?
'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;
UPDATE

As you can see on my Google Chrome console $ stateParams or $ state undefined!
angularjs angular-ui-router
HelloWorld
source share