testLink

Mon Mar 29 2021 10:55:46 GMT+0000 (UTC)

Saved by @tas4w #typescript

  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>
content_copyCOPY