diff --git a/src/app/content-creation/content-creation.component.html b/src/app/content-creation/content-creation.component.html index fbcd98a34adc8af51f9bbd971d6e1baf59211597..2e435d223b65946b72248579b43cd2780a0a3bc3 100644 --- a/src/app/content-creation/content-creation.component.html +++ b/src/app/content-creation/content-creation.component.html @@ -1,20 +1,12 @@ -<form (ngSubmit)="addContent(subjectTitle.value, bodyText.value, contentRound.value)"> +<form (ngSubmit)="addContent(subjectTitle.value, bodyText.value)"> <div fxLayout="column" fxLayoutAlign="center" fxLayoutGap="10px"> <mat-form-field> - <input class="input-block" #subjectTitle matInput (keypress)="resetEmptyInputs()" placeholder="Subject" [(ngModel)]="subject" - name="Title"> - <button mat-button *ngIf="subject" type="text" matSuffix mat-icon-button aria-label="Clear" (click)="subject=''"> - <mat-icon>close</mat-icon> - </button> + <input class="input-block" #subjectTitle matInput (keypress)="resetEmptyInputs()" placeholder="Subject" [(ngModel)]="subject"> </mat-form-field> <mat-form-field> - <input class="input-block" #contentRound matInput (keypress)="resetEmptyInputs()" placeholder="Round" [(ngModel)]="round" - name="Round"> - </mat-form-field> - <mat-form-field> - <textarea #bodyText matInput matTextareaAutosize matAutosizeMinRows="3" matAutosizeMaxRows="8" (keypress)="resetEmptyInputs()" - placeholder="Body" [(ngModel)]="body" name="Text"></textarea> - <button mat-button *ngIf="body" type="text" matSuffix mat-icon-button aria-label="Clear" (click)="body=''"> + <input class="input-block" #bodyText matInput matTextareaAutosize matAutosizeMinRows="3" matAutosizeMaxRows="8" (keypress)="resetEmptyInputs()" + placeholder="Body" [(ngModel)]="body"> + <button mat-button matSuffix mat-icon-button aria-label="Clear" (click)="subject=''; body=''"> <mat-icon>close</mat-icon> </button> </mat-form-field> diff --git a/src/app/content-creation/content-creation.component.ts b/src/app/content-creation/content-creation.component.ts index 6ec523824cb8e7c36a608f7bc853b1b8d6142575..98aa071df1c913f6c9b8d69f2bdf6201334b6629 100644 --- a/src/app/content-creation/content-creation.component.ts +++ b/src/app/content-creation/content-creation.component.ts @@ -14,8 +14,8 @@ import { RoomComponent } from '../room/room.component'; export class ContentCreationComponent implements OnInit { subject: string; body: string; - roomId: string; emptyInputs = false; + constructor( private contentService: ContentService, private router: Router, @@ -42,7 +42,7 @@ export class ContentCreationComponent implements OnInit { this.emptyInputs = true; return; } - this.contentService.addContent({ subject: subject, body: body, this.roomId } as Content) + this.contentService.addContent({ subject: subject, body: body } as Content) .subscribe(content => { this.notification.show(`Content '${content.subject}' successfully created.`); this.router.navigate([`/creator/room/${content.roomId}/${content.id}`]);