From c9aef5ea4dd75adcb03ebc621e0d491dcc7d9afd Mon Sep 17 00:00:00 2001
From: Thomas Lenz <Thomas.Lenz@mni.thm.de>
Date: Wed, 4 Apr 2018 13:50:46 +0200
Subject: [PATCH] Implement logic to check for empty inputs

---
 .../content-text-participant.component.ts            | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/app/components/fragments/content-text-participant/content-text-participant.component.ts b/src/app/components/fragments/content-text-participant/content-text-participant.component.ts
index a1cce801b..eb681e7ee 100644
--- a/src/app/components/fragments/content-text-participant/content-text-participant.component.ts
+++ b/src/app/components/fragments/content-text-participant/content-text-participant.component.ts
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
 import { ContentText } from '../../../models/content-text';
 import { ContentAnswerService } from '../../../services/http/content-answer.service';
 import { AnswerText } from '../../../models/answer-text';
+import { NotificationService } from '../../../services/util/notification.service';
 
 @Component({
   selector: 'app-content-text-participant',
@@ -16,10 +17,11 @@ export class ContentTextParticipantComponent implements OnInit {
     'This is the body of Text Content 1',
     1);
 
-  textAnswer: string;
+  textAnswer = '';
   isAnswerSend = false;
 
-  constructor(private answerService: ContentAnswerService) {
+  constructor(private answerService: ContentAnswerService,
+              private notificationService: NotificationService) {
   }
 
   ngOnInit() {
@@ -27,7 +29,13 @@ export class ContentTextParticipantComponent implements OnInit {
 
 //  submitAnswer(answer: string) {
   submitAnswer() {
+    if (this.textAnswer.trim().valueOf() === '') {
+      this.notificationService.show('No empty answer allowed.');
+      this.textAnswer = '';
+      return;
+    }
     this.isAnswerSend = true;
+    this.notificationService.show('Answer successfully sent.');
 /*    this.answerService.addAnswerText({
       id: '0',
       revision: this.content.revision,
-- 
GitLab