我可以帮您进行翻译。这段内容是关于编程的,意思是“当我选择一个选项时,我的模型无法更新。”以下是需要翻译的内容:
在我的controller.js文件中,我有以下内容:
这是我的视图:
<select data-ng-model="period" ng-options="item.value as item.text for item in periodOptions"></select>
在我的controller.js文件中,我有以下内容:
$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);
});
};
$scope.period不会获得用户选择的选项的值。我花了很多时间,但仍然无法找出原因。