【问题标题】:Can we display data in html table using ng-model in angular,database is firestore我们可以在 html 表中使用 ng-model 以角度显示数据吗,数据库是 firestore
【发布时间】:2019-09-19 08:40:31
【问题描述】:

我想以表格格式显示我的数据,它出现在输入字段中但不在表格中,为什么会这样?我该如何解决这个问题。

<!DOCTYPE html>
<h1>Call Details Dashboard </h1>
    <label>Name:</label>
    <select [(ngModel)] = "selectedLevel" (change)="selected()" >
      <option *ngFor="let post of posts | async" [ngValue]="post">{{post.user}} 
      </option>
    </select>
<table class="TFtable">  
      <tr >   
          <th>Name</th> <th>Duration</th>  <th>Time</th> <th>Type</th>  
      </tr>  

  <tr *ngFor="let post of posts |async" [(ngModel)] = "selectedLevel.user">
    <td>{{ post.callDuration }}</td>
    <td>{{ post.callTime }}</td>
    <td>{{ post.callType }}</td>
  </tr>  
</table>  //require not as per my requirement


<label>Duration:</label>
<input type="type"name="callDuration" [(ngModel)]="selectedLevel.callDuration"> //wokring perfect

【问题讨论】:

标签: angular google-cloud-firestore


【解决方案1】:

您正在使用输入标签来显示您的数据。您需要使用表格标签。在这里您可以看到表格的示例代码。

stackblitz

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多