import { Component } from "@angular/core";
import { MessageService } from "primeng/api";
@Component({
selector: "app-root",
templateUrl: "./app.component.html",
providers: [MessageService]
})
export class AppComponent {
tutorials: Tutorial[];
constructor(
private messageService: MessageService
){}
myData() {
this.tutorials = [
{
title: "Queue",
category: "Data Structure",
rating: 4
},
{
title: "Circularly LinkedList",
category: "Data Structure",
rating: 5
},
{
title: "Doubly LinkedList",
category: "Data Structure",
rating: 3
},
{
title: "Singly LinkedList",
category: "Data Structure",
rating: 4
},
{
title: "Doubly Ended Queue",
category: "Data Structure",
rating: 5
},
{
title: "Binary Search Tree",
category: "Data Structure",
rating: 4
},
{
title: "Red Black Tree",
category: "Data Structure",
rating: 5
},
{
title: "Breadth First Search",
category: "Graph",
rating: 4
},
{
title: "Floyd's Cycle",
category: "Algorithm",
rating: 4
},
{
title: "Travelling Salesman Problem",
category: "Algorithm",
rating: 5
},
{
title: "Bellman Ford",
category: "Graph",
rating: 4
},
{
title: "KMP Algorithm",
category: "String",
rating: 5
}
];
}
gfg() {
this.messageService.add({
severity: "success",
summary: "GeeksforGeeks",
detail: "Angular PrimeNG Defer Component"
});
this.myData();
}
}
export interface Tutorial {
title?: string;
category?: string;
rating?: number;
}