@appcarvers/ngx-unitelist
Version:
This library is for Angular (2+) projects to build a list from passed data and provide pagination and filters and their callbacks after proper configuration.
39 lines (31 loc) • 825 B
text/typescript
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
({
selector: 'ngx-unite-sort',
templateUrl: './unitesort.component.html',
styleUrls: ['./unitesort.component.css']
})
export class UnitesortComponent implements OnInit {
() sortCoverClass;
() sortDataArray : Array<any>;
() sortChanged = new EventEmitter();
constructor() {
}
ngOnInit() {
}
sortValueClicked(clickedName)
{
var emitObject = {};
this.sortDataArray.forEach(element => {
if(element.name === clickedName)
{
element['value'] = element['value'] === 'asc' ? 'desc' : 'asc';
emitObject[element.name] = element.value;
this.sortChanged.emit(emitObject);
}
else
{
delete element['value'];
}
});
}
}