我有一个对象数组,ObjectsArr= [Object1 , Object2,Object3, Object4]
我想在我的视图中显示最后一个对象,如何在angularjs中做到这一点?
在我的网络应用程序中,我有像'Å'这样的字符,我有元标记, <meta charset="utf-8" >但这些字符没有在浏览器中显示.它们显示为问号"?" .
我正在使用Ionic框架?我错过了什么?
当我选择一个选项时,我无法更新我的模型.
这是我的观点:
<select data-ng-model="period" ng-options="item.value as item.text for item in periodOptions"></select>
Run Code Online (Sandbox Code Playgroud)
在我的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);
});
};
Run Code Online (Sandbox Code Playgroud)
$ scope.period不会获取从User中选择的选项的值.我花了很多时间在这上面,无法弄清楚为什么会发生这种情况.