Angular7甜蜜警报秀动态table

Angular 7 Sweet alert show dynamic table

我正在使用 Sweet alert 2 和 Angular 7,我正在尝试显示动态 table。

Json:

[
  {
    "name": "Steve",
    "age": 23
  },
  {
    "name": "John",
    "age": 30
  },
  {
    "name": "Daniel",
    "age": 18
  }
]

我试过使用 *ngFor 但不幸的是,它不起作用。

Swal({
  position: 'center',
  type: 'info',
  title: `Class Information`,
  html: `<table>
  <tr>
    <th>Name</th>
    <th>Age</th>
  </tr>
  <tr *ngFor="let person of persons">
    <td>{{person.name}}</td>
    <td>{{person.age}}</td>
  </tr>
</table>`,
});

或者我正在尝试显示我自己的组件。

  Swal({
      position: 'center',
      type: 'info',
      title: `Class Information`,
      html: `<class-component [inputClassInformation]="classInformationJson"></class-component>`
    });

这也不行。

我的目标是显示以下弹出窗口:

你需要为 Angular 7 使用 ngx-sweetalert2 来显示动态 table

ngx-sweetalert2

<swal title="Fill the form, rapidly">
  <table>
    <tr>
      <th>Name</th>
      <th>Age</th>
    </tr>
    <tr *ngFor="let person of persons">
      <td>{{person.name}}</td>
      <td>{{person.age}}</td>
    </tr>
  </table>
</swal>