From 3d670e6a8d666baed267c725bfdb0021f585014d Mon Sep 17 00:00:00 2001
From: mohammad <mohammad.alayoub@mni.thm.de>
Date: Fri, 30 Apr 2021 15:58:34 +0200
Subject: [PATCH] added array

---
 .../shared/topic-cloud-dialog/keyword.ts      |  7 +++++
 .../topic-cloud-dialog.component.html         |  6 ++--
 .../topic-cloud-dialog.component.ts           | 31 +++++++++++++++++--
 3 files changed, 38 insertions(+), 6 deletions(-)
 create mode 100644 src/app/components/shared/topic-cloud-dialog/keyword.ts

diff --git a/src/app/components/shared/topic-cloud-dialog/keyword.ts b/src/app/components/shared/topic-cloud-dialog/keyword.ts
new file mode 100644
index 000000000..e737650ed
--- /dev/null
+++ b/src/app/components/shared/topic-cloud-dialog/keyword.ts
@@ -0,0 +1,7 @@
+import { Identifiers } from "@angular/compiler";
+
+export interface Keyword{
+    keywordID: number;
+    keyword: string;
+    questions: string[];
+}
\ No newline at end of file
diff --git a/src/app/components/shared/topic-cloud-dialog/topic-cloud-dialog.component.html b/src/app/components/shared/topic-cloud-dialog/topic-cloud-dialog.component.html
index 69f6cc5d5..00d63c53f 100644
--- a/src/app/components/shared/topic-cloud-dialog/topic-cloud-dialog.component.html
+++ b/src/app/components/shared/topic-cloud-dialog/topic-cloud-dialog.component.html
@@ -1,10 +1,8 @@
 <mat-dialog-content>
 
   <mat-accordion>
-      <mat-expansion-panel
-                          (opened)="panelOpenState = true"
-                          (closed)="panelOpenState = false"
-                          *ngFor="let keyword of array">
+      <mat-expansion-panel 
+                          *ngFor="let keyword of keywords">
         <mat-expansion-panel-header class="color">
           <mat-panel-title>
             {{keyword.keyword}}
diff --git a/src/app/components/shared/topic-cloud-dialog/topic-cloud-dialog.component.ts b/src/app/components/shared/topic-cloud-dialog/topic-cloud-dialog.component.ts
index 93f2c867f..07322e349 100644
--- a/src/app/components/shared/topic-cloud-dialog/topic-cloud-dialog.component.ts
+++ b/src/app/components/shared/topic-cloud-dialog/topic-cloud-dialog.component.ts
@@ -1,4 +1,5 @@
 import { Component, OnInit } from '@angular/core';
+import {Keyword} from './keyword';
 
 @Component({
   selector: 'app-topic-cloud-dialog',
@@ -7,7 +8,7 @@ import { Component, OnInit } from '@angular/core';
 })
 export class TopicCloudDialogComponent implements OnInit {
   public panelOpenState = false;
-  public array = [
+  /* public keywords = [
     {
       keywordID: 1,
       keyword: "Cloud",
@@ -43,10 +44,35 @@ export class TopicCloudDialogComponent implements OnInit {
       ]
     }
   ];
-
+*/
   constructor() { }
 
+  keywords: Keyword[] = [];
+
   ngOnInit(): void {
+    let questions = ["Wie genau ist die Cloud aufgebaut?",
+    "Wieviel speicherplatz steht mir in der Cloud zur verfuegung?",
+    "Sollen wir die Tag Cloud implementieren?"];
+    this.pushToArray(1, "cloud", questions);
+
+    questions = ["Muss man fuer das Modul SWT bestanden haben?"];
+    this.pushToArray(2, "SWTP", questions);
+
+    questions = ["Das ist eine Lange Frage mit dem Thema 'frage'",
+    "Ich habe eine Frage, sind Fragen zum thema 'Frage' auch erlaubt?",
+    "Ich wollte Fragen ob sie gerne Sachen gefragt werden",
+    "Langsam geht mir die Fragerei mit den ganzen Fragen auf den Geist"];
+    this.pushToArray(3, "Frage", questions);
+  }
+
+  pushToArray(id: number, key: string, questions: string[]){
+      let _keyword = {
+          keywordID: 1,
+          keyword: "test",
+          questions: questions
+      }
+
+      this.keywords.push(_keyword);
   }
 
   editKeyword(id: number): void{
@@ -54,6 +80,7 @@ export class TopicCloudDialogComponent implements OnInit {
   }
 
   deleteKeyword(id: number): void{
+
       console.log("keyword with ID "+id+" has been deleted");
   }
 }
-- 
GitLab