md-select-close on click close md-select


In angularJs when we are using md-select on MODAL when we are using then autoclose is not working here is the solution :-

<div class="modal fade add-pop-form md-select-close" id="modalOpen" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body">
                <div class="body-middle-part">

var dialogContainer = angular.element(document.querySelector('.md-select-close')),      
mdSelects = document.getElementsByTagName('md-select');     
dialogContainer.bind('click', function (event) {        
    var closeMdSelect = true;       
    angular.forEach(mdSelects, function (mdSelect) {        
        mdSelect = angular.element(mdSelect);       
            // what I do here is to check if the click event was triggered by the md-select I want to close. When opening the md-select, it will automatically close it, so I make sure that whenever this md-select is clicked, I don't hide it.       
            if ( || mdSelect.has( != 0) {      
                closeMdSelect = false;      
                return false;       
    if (closeMdSelect) {        


Please enter your comment!
Please enter your name here