Jul*_*ira 4 ngx-bootstrap angular
我试图使用带有循环变量数据的模板显示弹出窗口,但出现以下错误:
There is no directive with "exportAs" set to "bs-popover" ("template>
<span [popover]="popTemplate" popoverTitle="Anomalies" triggers="" [ERROR ->]#pop="bs-popover"></span>
<span *ngIf="vehicle.anomalies.length > 0" class="ba"): ng:///VehiclesModule/VehiclesSearchComponent.html@61:89
Can't bind to 'popover' since it isn't a known property of 'span'. ("
</ul>
</ng-template>
<span [ERROR ->][popover]="popTemplate" popoverTitle="Anomalies" triggers="" #pop="bs-popover"></span>
"): ng:///VehiclesModule/VehiclesSearchComponent.html@61:28
Error: Template parse errors:
There is no directive with "exportAs" set to "bs-popover" ("template>
<span [popover]="popTemplate" popoverTitle="Anomalies" triggers="" [ERROR ->]#pop="bs-popover"></span>
<span *ngIf="vehicle.anomalies.length > 0" class="ba"): ng:///VehiclesModule/VehiclesSearchComponent.html@61:89
Can't bind to 'popover' since it isn't a known property of 'span'. ("
</ul>
</ng-template>
<span [ERROR ->][popover]="popTemplate" popoverTitle="Anomalies" triggers="" #pop="bs-popover"></span>
"): ng:///VehiclesModule/VehiclesSearchComponent.html@61:28
Run Code Online (Sandbox Code Playgroud)
我的组件HTML是这样的:
<table class="table table-bordered table-striped table-sm table-hover">
<thead>
<tr>
<th>
<input #chkAll type="checkbox" (click)="selectAll(chkAll.checked)" />
</th>
<th>Chassis</th>
<th>Última Atualização</th>
<th>MVS</th>
<th>Pátio</th>
<th>Localização</th>
<th class="actions-col-2"></th>
</tr>
</thead>
<tbody>
<tr *ngFor="let vehicle of vehicles; let idx = index">
<td>
<input type="checkbox" id="vehicle-{{vehicle.id}}" name="vehicle-select" [(ngModel)]="vehicles[idx].checked" value="{{vehicle.id}}"
/>
</td>
<td>{{vehicle.chassis}}</td>
<td>{{vehicle.lastUpdate || '' | amFromUtc | amDateFormat: 'DD/MM/YYYY'}}</td>
<td>{{vehicle.mvsDescription}}</td>
<td>{{vehicle.yard.description}}</td>
<td>{{vehicle.location}}</td>
<td>
<ng-template #popTemplate>
<ul *ngFor="let anomaly of vehicle.anomalies">
<li>
<b>Componente:</b> {{anomaly.componentId}}
<b>Posição:</b> {{anomaly.tesisPosition}}
<b>Defeito:</b> {{anomaly.tesisDefect}}</li>
</ul>
</ng-template>
<span [popover]="popTemplate" popoverTitle="Anomalies" triggers="" #pop="bs-popover"></span>
<span *ngIf="vehicle.anomalies.length > 0" class="badge badge-pill badge-danger" (mouseenter)="pop.show()" (mouseleave)="pop.hide()">{{vehicle.anomalies.length}}</span>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
PS:我已经将PopoverModule添加到AppModule的导入中。
小智 5
确保将导入PopoverModule到声明为的模块中VehiclesSearchComponent。
@NgModule({
// ...
imports: [PopoverModule], <----
declarations: [VehiclesSearchComponent],
})
export class NameModule {
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2270 次 |
| 最近记录: |