I currently have a situation where I want to prevent the md-select from opening under a specific condition and instead display a warning dialog.
One way I can achieve this is by disabling the md-select using the following code:
ng-disabled="controller.unsavedChangesMade"
However, I would prefer a solution that allows the user to click on the dropdown, triggering the warning dialog without the md-select list appearing. Removing ng-disabled causes both the dialog and dropdown list to show up.
<md-input-container>
<label>Select Item</label>
<md-select ng-disabled="controller.unsavedChangesMade" ng-model = "selectedItem" ng-click="controller.handleItemChange(selectedItem.name, $event)" aria-label="Selected Item">
<md-option ng-repeat = "(index,item) in controller.items" ng-value = "item"
ng-click = "controller.getItemByCategory(item.name)">
{{item.name}}
</md-option>
</md-select>
</md-input-container>
I have explored using
$event.stoppropagation()
but it did not prevent the dropdown list from opening.
If you have any insights on how to achieve this, I would greatly appreciate your help. Thank you.
Best regards