Just enter it into your actual directory function, and then it can be used throughout your directive (including the link function).
app.directive('myDirective', function($compile, $filter){
return {
restrict: 'A',
scope: {
ngModel: '=',
},
require: 'ngModel',
link: function($scope, elem, attr, ctrl) {
}
};
});
, angular. , , .