I'm using the angular material, and I need a close button when I make the select selection, it just closes the box if I click outside, below has an example:
HTML:
<div ng-controller="MyCtrl" layout layout-align="center center">
<md-select ng-model="myModel" placeholder="Escolha" ng-change="onChange()" md-on-open="onOpen()">
<md-option value="0">Opção A</md-option>
<md-option value="1">Opção B</md-option>
<button>fechar (x)</buton>
</md-select>
</div>
Javascript:
angular.module('MyApp', ['ngMaterial'])
.controller('MyCtrl', function ($scope) {
$scope.onChange = function() {
//alert('on change');
};
$scope.onOpen = function() {
//alert('on open');
};
})
I did that, but it did not work:
<md-button ng-click="fechar()">Botão fechar select</md-button>
$scope.fechar = function () {
$mdSelect.hide();
};
ReferenceError: $mdSelect is not defined