I am getting data from local database and sort it at pipes .Somehow sorting is effecting the data is being feched from database
this is my ts file it takes data from provider
this.database.getdata("aaaaaaaa").then((res)=>{console.log("res:",res);Object.assign(this.contac,res);Object.assign(this.mock,res);;console.log("mock firts:",this.mock)}).then(()=>{console.log("gercek contac:",this.contac);console.log()}).then(()=>{ this.database.getdata("gruplar").then((res)=>{res.forEach(element => {
this.gruplar.push(element);console.log("res:",res)
});}).then(()=>{ loader.dismiss()
as you can see i got res from data base and it is an object .I combine it with an empty object which is contac.the data is {name:[B,A,C,D]}
I am expecting res is {name:[B,A,C,D]}
and contac is {name:[A,B,C,D]}
BUT I am having res is like this {name:[A,B,C,D]} > INTERESTING
it s fine without sorting pipe but i want to sort contac on view
this is my HTML page
<ion-item-sliding *ngFor="let item of contac.name|sorting">
<ion-item >
<!--(press)="pressEvent($event)"-->
<ion-label >{{item}}</ion-label>
<ion-checkbox [checked]=states.checktool color="dark" (ionChange)="addtodata(item,$event)"></ion-checkbox>
Pipe.ts
@Injectable()
export class Sorting {
/*
Takes a value and makes it lowercase.
*/
transform(array?: Array<string>, args?: string): Array<string> {
// array.sort();
if(array!==undefined){
array.sort()
}
return array;
}
}
ANY suggestion
Thankyou in advance