我正在使用Ionic Framework开发移动应用程序。我有一个如下所述的对象数组(app.js):
$scope.versesList = [
{id:"1" , value:'5', checked:($scope.selectedItem==this)} ,
{id:"2" , value:'10', checked:($scope.selectedItem==this)} ,
{id:"3" , value:'15', checked:($scope.selectedItem==this)} ,
{id:"4" , value:'20', checked:($scope.selectedItem==this)}
];
$scope.selectedItem = $scope.versesList[1];
这是产生输出的代码:
<div class="item">
<pre ng-bind="versesList | json"></pre>
</div>
这是输出:
[
{
"id" : "1",
"value" : "5",
"checked" : false
},
{
"id" : "2",
"value" : "10",
"checked" : false
},
{
"id" : "3",
"value" : "15",
"checked" : false
},
{
"id" : "4",
"value" : "20",
"checked" : false
}
]
我想检查第二个JSONObject以显示true。我怀疑检查项目的比较是否导致此错误。
任何代码帮助将不胜感激