Avi*_*Raj 1 javascript unit-testing karma-jasmine angular
ng test 显示以下错误,但它在现实中按预期工作。
Error: Template parse errors:
No provider for NgControl ("
<div class="form-group">
<label class="control-label">Location</label>
[ERROR ->]<select class="selectpicker" *ngIf="locations" data-style="btn btn-primary btn-round" title="Select A"): VehicleFormComponent@27:4
No provider for NgControl (" <div class="form-group label-floating">
<label class="control-label">Is Available</label>
[ERROR ->]<md-slide-toggle [(ngModel)]="isAvailable" color="primary" [ngModelOptions]="{standalone: true}">
"): VehicleFormComponent@41:4 in src/test.ts (line 25739)
Expected undefined to be truthy.
Run Code Online (Sandbox Code Playgroud)
我认为这主要是因为添加[ngModelOptions]="{standalone: true}"了自定义标签。
您是否在 TestBed 模块中添加了对“FormsModule”的引用?
import { FormsModule } from '@angular/forms';
TestBed.configureTestingModule({
imports: [ FormsModule ]
})
.compileComponents();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10219 次 |
| 最近记录: |