【发布时间】:2020-05-22 03:46:56
【问题描述】:
我使用 ng-select 来满足我对可搜索下拉列表的要求。 下拉菜单工作得很好。但是在 ng-template 上会抛出 html 错误。
即let-item="item"
如果我对上述行进行任何更改,则不会加载下拉列表。
这是抛出的错误
The template context of 'ɵf' does not define a member called 'item'ng(0)
虽然我在下拉菜单的工作中没有遇到任何问题,但这些错误在 CI/CD 过程中阻止了我。即当我使用npm run-script build 时,会显示这些错误。这将影响我的产品发布。
<ng-select required [items]="requestTypes" id="RequestTypeId" formControlName="RequestType" bindLabel="requestTypeName" appendTo="body" [(ngModel)]="accountFilters.requestTypeObject" placeholder="Select Client" class="font" [ngClass]="{ 'esubmit': submitted && accountConfigForm.controls.RequestType.errors }">
<ng-template ng-option-tmp let-item="item">
<div title="{{item.requestTypeName}}">{{item.requestTypeName}}</div>
</ng-template>
</ng-select>
【问题讨论】:
标签: html angular typescript angular8 ng-template