I have the following select:
<div class="form-group">
<label class="col-md-4 control-label" for="activity">Activity</label>
<div class="col-md-4">
<select id="activity" name="activity" class="inputsvalues" ng-model="activitymodel.deptid" ng-change="getUsers(activitymodel.deptid)" ng-options="activity.DepartmentId as activity.ActivityDescription for activity in activities"></select>
</div>
</div>
The controller code:
$scope.getUsers = function (id) {
$http({
method: 'GET',
url: 'api/User/GetUsers/' + id,
}).success(function (data, status, header) {
$scope.users = data;
}).error(function (data, status, headers, config) {
$scope.status = status + ' ' + headers;
});
}
The problem is that the ng-change function gets fired the first timeI select something. Second time onwards, it doesnt hit the controller. What could be wrong here?