Commit 7afea454 authored by Thodoris Nestoridis's avatar Thodoris Nestoridis

Boilerplate list

parent 04fa07be
...@@ -10,8 +10,7 @@ export interface PeriodicElement { ...@@ -10,8 +10,7 @@ export interface PeriodicElement {
has_main: boolean; has_main: boolean;
has_suffix: boolean; has_suffix: boolean;
} }
const ELEMENT_DATA: PeriodicElement[] = [{id: 5, title:"ss", has_prefix: false, has_main:true, has_suffix:true}, const ELEMENT_DATA: Boilerplate[] = [{}];
{id: 6, title:"s222s", has_prefix: false, has_main:true, has_suffix:true}];
@Component({ @Component({
selector: 'app-boilerplate-list', selector: 'app-boilerplate-list',
...@@ -26,7 +25,7 @@ export class BoilerplateListComponent implements OnInit { ...@@ -26,7 +25,7 @@ export class BoilerplateListComponent implements OnInit {
currentIndex = -1; currentIndex = -1;
title = ''; title = '';
displayedColumns: string[] = ['id', 'title', 'has_prefix', 'has_main', 'has_suffix']; displayedColumns: string[] = ['id', 'title', 'has_prefix', 'has_main', 'has_suffix'];
dataSource = [{}]; //ELEMENT_DATA; dataSource :Boilerplate[] = [{}];
constructor(private boilerplateService: BoilerplateService) { } constructor(private boilerplateService: BoilerplateService) { }
...@@ -35,18 +34,18 @@ export class BoilerplateListComponent implements OnInit { ...@@ -35,18 +34,18 @@ export class BoilerplateListComponent implements OnInit {
} }
retrieveBoilerplates(): void { retrieveBoilerplates(): void {
this.dataSource = [{}]; // this.dataSource = this.boilerplates
this.boilerplateService.getAll() this.boilerplateService.getAll()
.subscribe( .subscribe(
data => { data => {
this.boilerplates = data; this.boilerplates = data;
//this.boilerplates = this.dataSource; this.dataSource = data;
data.forEach(val => this.dataSource.push(Object.assign(val)));
console.log(this.dataSource); console.log(this.dataSource);
}, },
error => { error => {
console.log(error); console.log(error);
}); });
} }
refreshList(): void { refreshList(): void {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment