I'm writing an angular directive to wrap up logic for some custom dropdowns. My directive has 3 dropdowns, any number of which may actually be used.
My directive (stripped down) looks like this:
app.directive('dropdowns',
['$http', '$filter', ...
function($http, $filter, ...) {
return {
restrict: 'E',
templateUrl: '/Some_template',
scope: {
customer: '=?',
warehouse: '=?',
location: '=?',
link: function (scope, elm, attrs) {
//How do I tell if scope.customer is set to a binding?
}
}
}]);
How do I check whether the dropdown bindings are actually bound to some other variable? To be clear, I can't check whether the variable is truthy because undefined values are fine. For example, if my HTML looks like this:
<dropdowns customer="customer" warehouse="warehouse"></dropdowns>
how can I tell that customer and warehouse are set, but location isn't? Ultimately I'm using that information to show/hide the relevant dropdowns. I'd rather just check these bindings instead of just adding another few bindings to my isolate scope.