这是因为
ng-value
正在寻找“全部”
$scope
变量,但可能没有。
如果期望值是字符串,则使用
'All'
或者,只是使用
value
.
angular.module('app', []);
angular.module('app').controller('FiberLead_Filter', function($scope, $http, $rootScope) {
$scope.DownloadExcelReport = function(){
console.log($scope.MPSelect);
}
}
);
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.25/angular.min.js"></script>
<div ng-app="app">
<div class="rightFilter" ng-controller="FiberLead_Filter as Filter" id="FiberLead_Filter">
<div class="pdfDownload customeRadioWrap">
<div class="customeRadio">
<input type="radio" id="btnCurrentMP" name="radio-group" ng-model="MPSelect" value="Current">
<label for="btnCurrentMP">Current MP</label>
</div>
<div class="customeRadio">
<input type="radio" id="btnAllMP" name="radio-group" ng-model="MPSelect" value="All">
<label for="btnAllMP">All MP</label>
</div>
<button class="btn btn-default customBtn" ng-click="DownloadExcelReport()"><i class="fa fa-file-pdf-o" aria-hidden="true"></i> Download</button>
</div>
</div>
</div>