website init
This commit is contained in:
1
WEB/src/app/components/songs/songs.component.html
Normal file
1
WEB/src/app/components/songs/songs.component.html
Normal file
@@ -0,0 +1 @@
|
||||
<app-table [songs]="songs"></app-table>
|
||||
0
WEB/src/app/components/songs/songs.component.less
Normal file
0
WEB/src/app/components/songs/songs.component.less
Normal file
25
WEB/src/app/components/songs/songs.component.spec.ts
Normal file
25
WEB/src/app/components/songs/songs.component.spec.ts
Normal 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();
|
||||
});
|
||||
});
|
||||
22
WEB/src/app/components/songs/songs.component.ts
Normal file
22
WEB/src/app/components/songs/songs.component.ts
Normal 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;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
31
WEB/src/app/components/songs/table/table.component.html
Normal file
31
WEB/src/app/components/songs/table/table.component.html
Normal 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>
|
||||
4
WEB/src/app/components/songs/table/table.component.less
Normal file
4
WEB/src/app/components/songs/table/table.component.less
Normal file
@@ -0,0 +1,4 @@
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
25
WEB/src/app/components/songs/table/table.component.spec.ts
Normal file
25
WEB/src/app/components/songs/table/table.component.spec.ts
Normal 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();
|
||||
});
|
||||
});
|
||||
26
WEB/src/app/components/songs/table/table.component.ts
Normal file
26
WEB/src/app/components/songs/table/table.component.ts
Normal 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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user