我有一个AngularJS材质选择:
<md-input-container style="margin-right: 10px;">
<label>Roll</label>
<md-select id="acc-type" required="" ng-model="rolle">
<md-option ng-selected="true" value="Tenant">Tenant</md-option>
<md-option value="Lessor">Lessor</md-option>
</md-select>
</md-input-container>我想要得到实际选择的选项。我试过了
var e = document.getElementById("acc-type");
var selectedItem = e.value;但我所收到的一切都是未知的。在AngularJS中有没有获取md-select值的选项?
发布于 2019-06-28 18:04:44
由于您已经在md-select中定义了ng-model="rolle",因此可以通过$scope.rolle访问它
尝试:
var selectedItem = $scope.rolle发布于 2019-06-28 15:10:24
它在angular Js和model中已经被分配,所以try Try
console.log($scope.rolle);https://stackoverflow.com/questions/56802122
复制相似问题