<mat-accordion > <mat-expansion-panel (click)="commentOpen(post.id)"> <mat-expansion-panel-header *ngIf="panelOpenState"> <mat-panel-title> Self aware panel </mat-panel-title> <mat-panel-description> Currently I am {{panelOpenState ? 'open' : 'closed'}} </mat-panel-description> </mat-expansion-panel-header> <form [formGroup]="commentForm" > <input matInput type="text" formControlName="email" placeholder="email" #commentEmail required> <input matInput type="text" formControlName="name" #commentName placeholder="name" required> <textarea matInput class="commentArea" formControlName="body" #commentBody placeholder="Commenta..."></textarea> <button type="submit" [disabled]="commentForm.invalid" (click)="onSubmitComment(commentEmail.value, commentName.value, commentBody.value, post.id)">Invia</button> </form> <div id="txtdataCommens" *ngFor="let comment of comments"> {{comment.id}} <br> {{comment.email}} <br> {{comment.name}} <br> {{comment.body}} </div> </mat-expansion-panel> </mat-accordion>
panelOpenState = false; commentOpen(idPost:any){ this.commentService.postId = idPost this.getCommentDetailByUser(); this.panelOpenState = !this.panelOpenState }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)