import { Component } from
"@angular/core"
;
import { MessageService } from
"primeng/api"
;
@Component({
selector:
"app-root"
,
templateUrl:
"./app.component.html"
,
providers: [MessageService]
})
export class AppComponent {
cols: any[];
tutorials: Tutorial[];
constructor(private messageService: MessageService) {}
ngOnInit() {
this
.tutorials = [
{
id: 1,
title:
"Queue"
,
category:
"Data Structure"
,
rating: 8
},
{
id: 2,
title:
"Circularly LinkedList"
,
category:
"Data Structure"
,
rating: 1
},
{
id: 3,
title:
"Doubly LinkedList"
,
category:
"Data Structure"
,
rating: 3
},
{
id: 4,
title:
"Singly LinkedList"
,
category:
"Data Structure"
,
rating: 5
},
{
id: 5,
title:
"Doubly Ended Queue"
,
category:
"Data Structure"
,
rating: 10
},
{
id: 6,
title:
"Binary Search Tree"
,
category:
"Data Structure"
,
rating: 2
},
{
id: 7,
title:
"Red Black Tree"
,
category:
"Data Structure"
,
rating: 9
},
{
id: 8,
title:
"Breadth First Search"
,
category:
"Graph"
,
rating: 6
},
{
id: 9,
title:
"Floyd's Cycle"
,
category:
"Algorithm"
,
rating: 7
},
{
id: 10,
title:
"Travelling Salesman Problem"
,
category:
"Algorithm"
,
rating: 4
},
{
id: 11,
title:
"Bellman Ford"
,
category:
"Graph"
,
rating: 8
},
{
id: 12,
title:
"KMP Algorithm"
,
category:
"String"
,
rating: 10
}
];
this
.cols = [
{ field:
"id"
, header:
"Id"
},
{ field:
"title"
, header:
"Title"
},
{ field:
"category"
, header:
"Category"
},
{ field:
"rating"
, header:
"Rating"
}
];
}
toast(){
this
.messageService.add({
severity:
"success"
,
detail:
"Success! CSV file downloaded"
});
}
}
export interface Tutorial {
id?: number;
title?: string;
category?: string;
rating?: number;
}