Having trouble updating my model when I choose an option.
Below is my view code:
<select data-ng-model="period" ng-options="item.value as item.text for item in periodOptions"></select>
In my controller.js, this is what I have :
$scope.periodOptions = [
{ text: "This week", value: 'week' },
{ text:"This month", value: 'month '},
{ text:"This year", value: 'year' },
{ text:"All times", value: 'all-time '}
];
$scope.Search = function () {
return $http({
url: '/api/get',
method: 'GET',
params: {
period: $scope.period
}
}).then(function(response) {
console.log(response);
}, function(reason) {
alert(reason);
});
};
The problem is that $scope.period does not update with the selected option from the User. Can't seem to figure out why after spending many hours on this issue.