小编Ket*_*era的帖子

ngtsc(2345) -“Event”类型的参数不可分配给“SortEvent”类型的参数

我是角度新手。我一直在尝试对列进行排序,但不断收到此错误:

“Event”类型的参数不可分配给“SortEvent”类型的参数。类型“Event”缺少类型“SortEvent”中的以下属性:列、方向 - ngtsc(2345)。

关于如何开展这项工作有什么建议吗?

s-产品管理.component.html:

<form>
        <div class="form-group form-inline">
        Full text search: <input class="form-control ml-2" type="text" name="searchTerm" [(ngModel)]="service.searchTerm"/>
        <span class="ml-3" *ngIf="service.loading$ | async">Loading...</span>
        </div>
                          
        <table class="table table-striped">
             <thead>
                 <tr>
                   <th scope="col">#</th>
                   <th scope="col" sortable="name" (sort)="onSort($event)">Country</th>
                   <th scope="col" sortable="area" (sort)="onSort($event)">Area</th>
                   <th scope="col" sortable="population" (sort)="onSort($event)">Population</th>
                 </tr>
              </thead>
              <tbody>
               <tr *ngFor="let product of products$ | async">
                <th scope="row">{{ product.id }}</th>
                 <td>
                  <img [src]="'https://upload.wikimedia.org/wikipedia/commons/' + product.flag" class="mr-2" style="width: 20px">
                  <ngb-highlight [result]="product.name" [term]="service.searchTerm"></ngb-highlight>
                  </td>
                  <td><ngb-highlight [result]="product.area | number" [term]="service.searchTerm"></ngb-highlight>
                  </td>
                  <td><ngb-highlight [result]="product.population | number" …
Run Code Online (Sandbox Code Playgroud)

html typescript ng-bootstrap angular

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

angular ×1

html ×1

ng-bootstrap ×1

typescript ×1