var app = angular.module('app', ['angular.filter']);
app.controller('homeCtrl', function($scope) {
$scope.data = {
"error": false,
"events": [{
"id": 1,
"title": "scenario1",
"flag":"locked",
"date": "2014"
}, {
"id": 2,
"title": "scenario2",
"flag":"unlocked",
"date": "2014"
}, {
"id": 3,
"title": "scenario3",
"flag":"locked",
"date": "2015"
}, {
"id": 4,
"title": "scenario4",
"flag":"unlocked",
"date": "2016"
}, {
"id": 5,
"title": "scenario5",
"flag":"unlocked",
"date": "2017"
}, {
"id": 6,
"title": "scenario6",
"flag":"unlocked",
"date": "2014"
}, {
"id": 7,
"title": "scenario7",
"flag":"unlocked",
"date": "2015"
}, {
"id": 7,
"title": "scenario8",
"flag":"locked",
"date": "2015"
}]
}
});
我能够进行分组明智的分裂,但我正在努力争取年份和国旗 我正在尝试此输出任何建议请建议
2014年 - 锁定
scenario1
2014 -unlocked
scenario2
scenario6
2015年 - 锁定
场景3
scenario8
2015年 - 解锁
scenario7
2016年 - 解锁
scenario4
2017年 - 解锁
scenario5
html页面是,
<div ng-app="app">
<div ng-controller="homeCtrl">
<div ng-repeat="(key, value) in data.events | groupBy: 'date'">
<div> <h1> {{key}}</h1> </div>
<a class="item item-thumbnail-left" href="#/app/event/{{event.id}}" ng-repeat="event in value">
<h3>{{event.title}}</h3>
</a>
</div>
</div>
</div>
</div>
答案 0 :(得分:1)
holder.transaction_history1 = (TextView)
row.findViewById(R.id.textView_matrimonyaccount_single_row_transaction_history1);
holder.transaction_history = (TextView)
row.findViewById(R.id.textView_matrimonyaccount_single_row_transaction_history);
holder.transaction_history1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if(info.transaction_history.equalsIgnoreCase("Confirm"))
{
holder.transaction_history1.setVisibility(View.VISIBLE);
Intent intent2 = new Intent (context,MainActiviy.class);
context.startActivity(intent2);
}
else
{
Toast.makeText(context,"",Toast.LENGTH_LONG);
}
}
});