angular - Group items based on Month and year along with date range and type filters in Ionic2 -
i need group following json data based on month , year(sttransactiondate)
[{"sttransactiondate":"2017-03-08","sttransactiotime":"12:29:14.96","sttransactiotype":"fs","strequestamount":"12.00","stcompletionamount":"12.00","sfee":"00.20","stdepositamount":"12.00","sttransactiodesc":"balance enquiry"},{"sttransactiondate":"2017-08-03","sttransactiotime":"12:29:14.96","sttransactiotype":"ca","strequestamount":"12.00","stcompletionamount":"12.00","sfee":"00.20","stdepositamount":"12.00","sttransactiodesc":"atm transaction"},{"sttransactiondate":"2017-03-11","sttransactiotime":"12:39:14.96","sttransactiotype":"fs","strequestamount":"12.00","stcompletionamount":"12.00","sfee":"00.20","stdepositamount":"12.00","sttransactiodesc":"balance enquiry"},{"sttransactiondate":"2017-03-11","sttransactiotime":"12:39:14.96","sttransactiotype":"ca","strequestamount":"12.00","stcompletionamount":"12.00","sfee":"00.20","stdepositamount":"12.00","sttransactiodesc":"balance enquiry"},{"sttransactiondate":"2017-03-08","sttransactiotime":"12:29:14.96","sttransactiotype":"ca","strequestamount":"12.00","stcompletionamount":"12.00","sfee":"00.20","stdepositamount":"12.00","sttransactiodesc":"balance enquiry"},{"sttransactiondate":"2016-03-08","sttransactiotime":"12:29:14.96","sttransactiotype":"ca","strequestamount":"12.00","stcompletionamount":"12.00","sfee":"00.20","stdepositamount":"12.00","sttransactiodesc":"balance enquiry"}]
i tried using customized pipe iam getting errors. along have apply filters need show fs,ca(sttransactiotype) , date range filters}(i.e, start date , end date).
anyone please me this...
i used following pipe code
import { pipe, pipetransform } "@angular/core"; @pipe({name: "filter",pure: false}) export class arrayfilterpipe implements pipetransform { transform(items: array<any>, conditions: {[field: string]: any}): array<any> { return items.filter(item => { (let field in conditions) { if (item[field].split('-')[1] !== conditions[field].split('-')[1] || item[field].split('-')[0] !== conditions[field].split('-')[0] ) { return false; } } return true; }); } }
and in html <ion-card reorder="true" ion-item *ngfor="let item of items1 | filter:{sttransactiondate:item.sttransactiondate} >
i getting error @ passing item.sttransactiondate filter
Comments
Post a Comment