website init

This commit is contained in:
Benjamin Ifland
2019-03-23 14:13:18 +01:00
parent 8842a192c7
commit 14a033a56c
54 changed files with 11443 additions and 1 deletions

View File

@@ -0,0 +1 @@
<app-table [songs]="songs"></app-table>

View File

@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SongsComponent } from './songs.component';
describe('SongsComponent', () => {
let component: SongsComponent;
let fixture: ComponentFixture<SongsComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SongsComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SongsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,22 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { SongListModel } from 'src/app/models/song-list.model';
@Component({
selector: 'app-songs',
templateUrl: './songs.component.html',
styleUrls: ['./songs.component.less']
})
export class SongsComponent implements OnInit {
public songs: SongListModel;
constructor(private route: ActivatedRoute) {}
ngOnInit() {
this.route.data.subscribe((data: { songs: SongListModel }) => {
this.songs = data.songs;
});
}
}

View File

@@ -0,0 +1,31 @@
<table *ngIf="songs.SongList" mat-table [dataSource]="songs.SongList" class="mat-elevation-z8">
<ng-container matColumnDef="Id">
<th mat-header-cell *matHeaderCellDef>#</th>
<td mat-cell *matCellDef="let element">{{element.Id}}</td>
</ng-container>
<ng-container matColumnDef="Name">
<th mat-header-cell *matHeaderCellDef>Titel</th>
<td mat-cell *matCellDef="let element">{{element.Name}}</td>
</ng-container>
<ng-container matColumnDef="Key">
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let element">{{element.Key}}</td>
</ng-container>
<ng-container matColumnDef="Type">
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let element">{{element.Type}}</td>
</ng-container>
<ng-container matColumnDef="Velocity">
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let element">{{element.Velocity}}</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="columns; sticky: true"></tr>
<tr mat-row *matRowDef="let row; columns: columns;" [routerLink]="['/songs', row.Id]" routerLinkActive="router-link-active" ></tr>
</table>

View File

@@ -0,0 +1,4 @@
table {
width: 100%;
}

View File

@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TableComponent } from './table.component';
describe('TableComponent', () => {
let component: TableComponent;
let fixture: ComponentFixture<TableComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TableComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TableComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,26 @@
import { Component, OnInit, Input } from '@angular/core';
import { SongListModel } from 'src/app/models/song-list.model';
@Component({
selector: 'app-table',
templateUrl: './table.component.html',
styleUrls: ['./table.component.less']
})
export class TableComponent implements OnInit {
@Input() public songs: SongListModel;
public columns = [
'Id',
'Name',
'Key',
'Type',
'Velocity',
];
constructor() { }
ngOnInit() {
console.log(this.songs);
}
}