Add ng-bootstrap, implement task form modal window

This commit is contained in:
jfhr
2020-06-03 17:04:44 +02:00
parent 0bd4205d02
commit 5f7e18fc04
9 changed files with 279 additions and 96 deletions

View File

@@ -1,12 +1,12 @@
<form>
<div class="form-group">
<label for="Title">Titel</label>
<input type="text" class="form-control" id="Title" required [(ngModel)]="title">
<input type="text" class="form-control" id="Title" required name="title" [(ngModel)]="title">
</div>
<div class="form-group">
<label for="Inhalt">Inhalt</label>
<input type="text" class="form-control" id="Content" required [(ngModel)]="content">
<input type="text" class="form-control" id="Content" required name="content" [(ngModel)]="content">
</div>
<button type="submit" class="btn btn-success">Submit</button>

View File

@@ -1,4 +1,5 @@
import { Component, OnInit, Input } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { BackendService, Task } from '../services/backend.service';
@Component({
@@ -15,7 +16,7 @@ export class TaskFormComponent implements OnInit {
public task: Task;
private submitted: boolean;
constructor(private backendService: BackendService) { }
constructor(private backendService: BackendService, private activeModalService: NgbActiveModal) { }
ngOnInit(): void {
if (this.task !== null && this.task !== undefined) {
@@ -35,5 +36,6 @@ export class TaskFormComponent implements OnInit {
this.backendService.postTask(this.task);
}
this.submitted = true;
this.activeModalService.close();
}
}