end WC-4
This commit is contained in:
parent
9e31c66d0d
commit
ecf5d90816
|
@ -13,3 +13,17 @@
|
|||
<!--<h1>{{myTextArea}}</h1>-->
|
||||
<button mat-raised-button (click)="addComment()">Dodaj komentarz</button>
|
||||
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<th>Użytkownik</th>
|
||||
<th>Komentarz</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let cm of comments" >
|
||||
<td *ngIf="cm.payload.doc.data().idUser == this.id">{{ cm.payload.doc.data().userName }}</td>
|
||||
<td *ngIf="cm.payload.doc.data().idUser == this.id">{{ cm.payload.doc.data().description }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ export class TombstoneComponent implements OnInit {
|
|||
private tombstones: any;
|
||||
myTextArea = 'Tu wpisz komentarz';
|
||||
username: string;
|
||||
private comments: any;
|
||||
|
||||
constructor(private tombstoneService: TombstoneService,
|
||||
private route: ActivatedRoute,
|
||||
|
@ -30,6 +31,7 @@ export class TombstoneComponent implements OnInit {
|
|||
});
|
||||
|
||||
this.getTombstone(this.id)
|
||||
this.getComment()
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:use-lifecycle-interface
|
||||
|
@ -51,6 +53,12 @@ export class TombstoneComponent implements OnInit {
|
|||
.subscribe(res =>(this.tombstones = res, console.log(res)));
|
||||
}
|
||||
|
||||
getComment(){
|
||||
this.commentService
|
||||
.getComment()
|
||||
.subscribe(res =>(this.comments = res, console.log(res)));
|
||||
}
|
||||
|
||||
addComment(){
|
||||
const comment = new Comment(this.getUserName(), this.id, this.myTextArea)
|
||||
|
||||
|
|
Loading…
Reference in New Issue