| предлагаем добавить атрибут ng-model в меню выбора, например,
ng-model="selectedValue"
Это будет содержать выбранное значение, и вы сможете получить доступ к этой переменной в вашем контроллере с помощью $scope.selectedValue
Вам также следует добавить атрибут ng-change
в ваше меню выбора, чтобы вы могли вызывать функцию всякий раз, когда выбрана опция.
HTML выберите код меню:
<select class="mdb-select md-form" ng-model="selectedValue" ng-change="selectSource()" aria-labelledby="dropdownMenuButton" id="sourcesByName">
<option class="dropdown-item" ng-repeat="source in showsource">{{source}} </option>
</select>
В вашем главном контроллере
var Report = angular.module('Report', []);
Report.controller('mainController', function($scope, $http) {
$scope.showdata = {};
$scope.selectSource = function(){
//This function will be called whenever a new option is selected.
//log the selectedValue to check it
console.log($scope.selectedValue);
//perform http request here with the selectedValue in order to retrieve
//the corresponding data from the database.
//Once the data is retrieved, we update the $scope.showdata variable. The view will be automatically updated.
};
});