It works when the first bind occurs,I want the list rebind data when a select input(id is 'checkin') changes,what should I do?
var m = angular.module('users', []);
m.controller('UserList', function($scope) {
$scope.getdata = function() {
var u = "http://www.example.com/admin?queryusers";
var userlist = this;
var body = {
activityid: "10",
checkin: $('#checkin').val()
};
$.ajax({
url: u,
type: "post",
async: false,
data: body,
success: function(data) {
userlist.users = data;
}
});
return userlist.users;
};
this.users=$scope.getdata();
$('#checkin').change(function() {
this.users=$scope.getdata();
$scope.$apply();
});
});