I am trying to create a custom validation directive for my Angular app. The only issue I'm facing is figuring out how to retrieve a value.
<select class="form-control" ng-model="$parent.newSector" ng-options="item.id as item.name for item in sectors" not-empty-array="merchant.sectors"></select>
In the markup above, you can see that I have used a directive called notEmptyArray where I pass an expression (similar to ng-model, but with a different name). How do I access this value within my directive?
directive = function({
require: "ngModel",
link: function(scope, element, attributes, control) {
// How can I access the value of merchant.sectors (which is an array in the scope)?
}
});