import { Component } from
"@angular/core"
;
import {
SelectItem,
FilterService,
FilterMatchMode
} from
"primeng/api"
;
@Component({
selector:
"app-root"
,
templateUrl:
"./app.component.html"
})
export class AppComponent {
cols: any[];
tutorials: Tutorial[];
matchModeOptions: SelectItem[];
constructor(private filterService: FilterService) {}
ngOnInit() {
this
.tutorials = [
{
title:
"Queue"
,
category:
"Data Structure"
,
rating: 8
},
{
title:
"Circularly LinkedList"
,
category:
"Data Structure"
,
rating: 1
},
{
title:
"Doubly LinkedList"
,
category:
"Data Structure"
,
rating: 3
},
{
title:
"Singly LinkedList"
,
category:
"Data Structure"
,
rating: 5
},
{
title:
"Doubly Ended Queue"
,
category:
"Data Structure"
,
rating: 10
},
{
title:
"Binary Search Tree"
,
category:
"Data Structure"
,
rating: 2
},
{
title:
"Red Black Tree"
,
category:
"Data Structure"
,
rating: 9
},
{
title:
"Breadth First Search"
,
category:
"Graph"
,
rating: 6
},
{
title:
"Floyd's Cycle"
,
category:
"Algorithm"
,
rating: 7
},
{
title:
"Travelling Salesman Problem"
,
category:
"Algorithm"
,
rating: 4
},
{
title:
"Bellman Ford"
,
category:
"Graph"
,
rating: 8
},
{
title:
"KMP Algorithm"
,
category:
"String"
,
rating: 10
}
];
this
.cols = [
{ field:
"title"
, header:
"Title"
},
{ field:
"category"
, header:
"Category"
},
{ field:
"rating"
, header:
"Rating"
}
];
this
.matchModeOptions = [
{ label:
"Less than"
, value: FilterMatchMode.LESS_THAN },
{
label:
"Less than or equal"
,
value: FilterMatchMode.LESS_THAN_OR_EQUAL_TO
},
{ label:
"Greater than"
, value: FilterMatchMode.GREATER_THAN },
{
label:
"Greater than or equal"
,
value: FilterMatchMode.GREATER_THAN_OR_EQUAL_TO
},
{ label:
"Equals"
, value: FilterMatchMode.EQUALS }
];
}
}
export interface Tutorial {
title?: string;
category?: string;
rating?: number;
}