constructor() {
this.hotelForm = new FormGroup({
name: new FormControl('', [
Validators.required,
Validators.minLength(5),
Validators.maxLength(30),
]),
city: new FormControl('', [
Validators.required,
Validators.pattern(/^[a-zA-Z áÁÍíéőöüéűŐÉÖÜ]{5,30}$/),
]),
category: new FormControl('', Validators.required),
});
}
ngOnInit(): void {}
saveHotel(): any {
const submittedHotel = this.hotelForm.value;
console.log(submittedHotel);
return submittedHotel;
}
}
<section class="table-holder">
<button id="get-button" (click)="getPostList()">Get Blog List</button>
<table>
<thead>
<tr>
<th>Title</th>
<th>Text</th>
<th>Category</th>
<th></th>
</tr>
</thead>
<tbody>
<tr class="table-row" *ngFor="let post of blogPosts; let i = index">
<td>{{ post.title }}</td>
<td>{{ post.text }}</td>
<td>{{ post.category }}</td>
<td>
<button id="delete-button" (click)="deletePost(post.id)">Delete</button>
</td>
</tr>
</tbody>
</table>
</section>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter