From 6d73add22169082aba29b0fdfa6d5e5c881543de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20J=C3=B3zefowicz?= Date: Mon, 13 Jan 2020 16:10:06 +0100 Subject: [PATCH] CHAL-12 (comments) --- front/src/app/app.module.ts | 4 +++- .../app/challange/challange.component.html | 23 +++++++++++++++++++ .../src/app/challange/challange.component.ts | 11 +++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/front/src/app/app.module.ts b/front/src/app/app.module.ts index c8e14e3..2c7096a 100644 --- a/front/src/app/app.module.ts +++ b/front/src/app/app.module.ts @@ -2,6 +2,7 @@ import { BrowserModule } from '@angular/platform-browser'; import { ReactiveFormsModule } from '@angular/forms'; import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; +import { FormsModule } from '@angular/forms'; // used to create fake backend import { fakeBackendProvider } from './_helpers'; @@ -23,7 +24,8 @@ import { AddChallangeComponent } from './addChallange'; BrowserModule, ReactiveFormsModule, HttpClientModule, - appRoutingModule + appRoutingModule, + FormsModule ], declarations: [ AppComponent, diff --git a/front/src/app/challange/challange.component.html b/front/src/app/challange/challange.component.html index e3a1f08..921905b 100644 --- a/front/src/app/challange/challange.component.html +++ b/front/src/app/challange/challange.component.html @@ -26,4 +26,27 @@
+
+

Komentarze

+
+
+ Autor + +
+
+ +
+
+ +
+
+
+
Autor
+
Komentarz
+
+
+
{{comment.author}}
+
{{comment.body}}
+
+
diff --git a/front/src/app/challange/challange.component.ts b/front/src/app/challange/challange.component.ts index d1ca4f2..3b5fe57 100644 --- a/front/src/app/challange/challange.component.ts +++ b/front/src/app/challange/challange.component.ts @@ -5,9 +5,16 @@ import { ChallangesService } from '@/_services'; @Component({ templateUrl: 'challange.component.html' }) export class ChallangeComponent implements OnInit { + comments = [ + {author: "szalony", body: "Wow, ale opcja!!!!!"}, + {author: "krejzol", body: "Nie wierzę!!!!!"}, + ] challange: Challange = null observing = false + author: string = ''; + body: string = ''; + constructor( private route: ActivatedRoute, private service: ChallangesService @@ -30,4 +37,8 @@ export class ChallangeComponent implements OnInit { this.observing = true this.challange.numberOfObservators += 1 } + + addComment() { + this.comments.push({author: this.author, body: this.body}) + } }