Besucher auf Struct umgeschrieben
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
.example-radio-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin: 15px 0;
|
||||
}
|
||||
|
||||
.example-radio-button {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
@@ -16,11 +16,14 @@
|
||||
</table>
|
||||
|
||||
<input placeholder="Ihre Name..." [(ngModel)]="BesucherName">
|
||||
<input placeholder="Eventuell eine Nachricht" [(ngModel)]="BesucherMessage">
|
||||
<input placeholder="Eventuell eine Nachricht" [(ngModel)]="BesucherMessage"><br />
|
||||
<label id="zusage-radio-button-group-label">Kommen Sie</label>
|
||||
<mat-radio-group>
|
||||
<mat-radio-button value="1">Ja</mat-radio-button>
|
||||
<mat-radio-button value="0">Nein</mat-radio-button>
|
||||
<mat-radio-group
|
||||
aria-labelledby="zusage-radio-button-group-label"
|
||||
class="example-radio-group"
|
||||
[(ngModel)]="BesucherKommtRadio"
|
||||
>
|
||||
<mat-radio-button class="example-radio-button" *ngFor="let entscheidung of kommt" [value]="entscheidung">{{entscheidung}}</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
<button class="btn btn-primary" (click)="addBesucher()">Abschicken</button>
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import { filter } from 'rxjs';
|
||||
import { BesucherService } from '../besucher.service';
|
||||
import { Besucher } from 'src/besucher';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-besucher',
|
||||
templateUrl: './besucher.component.html',
|
||||
@@ -17,8 +18,12 @@ export class BesucherComponent implements OnInit {
|
||||
kommendeBesuchers: Besucher[] = [];
|
||||
BesucherName: string = "";
|
||||
BesucherMessage: string = "";
|
||||
|
||||
BesucherKommt: boolean = false;
|
||||
|
||||
BesucherKommtRadio: string = "";
|
||||
kommt: string[] = ['Ja','Nein'];
|
||||
|
||||
constructor(private besucherService: BesucherService) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
@@ -48,13 +53,19 @@ export class BesucherComponent implements OnInit {
|
||||
name : this.BesucherName,
|
||||
message : this.BesucherMessage,
|
||||
id: '',
|
||||
come : this.BesucherKommt
|
||||
come : this.convertBesucherkommtStringToBoolean(this.BesucherKommtRadio)
|
||||
};
|
||||
console.log(newBesucher.come);
|
||||
this.besucherService.addBesucher(newBesucher).subscribe(() => {
|
||||
this.getAll();
|
||||
this.BesucherMessage = '';
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
convertBesucherkommtStringToBoolean(input: string) : boolean {
|
||||
return input == this.kommt[0]
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user