ich eine Angular 2-Komponenten haben, die gut funktionieren, aber wenn ich diesen Code ausführen ng test
alle Tests ich die followind Fehlermeldung weitergeben müssen:Angular 2 Test bekommt Fehler
Can't bind to 'ngModel' since it isn't a known property of 'mdl-textfield'.
1. If 'mdl-textfield' is an Angular component and it has 'ngModel' input, then verify that it is part of this module.
2. If 'mdl-textfield' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schema' of this component to suppress this message.
("ditedIndex !== i">{{role.name}}</span>
<mdl-textfield *ngIf="editedIndex === i" [ERROR ->][(ngModel)]="roles[i].name" class="full-width" value={{role.name}}></mdl-textfi
eld>
hier ist mein HTML:
<tr *ngFor="let role of roles; let i = index;" (click)="doSelect(role, i)">
<td class="table-id">{{ i + 1 }}</td>
<td>
<span *ngIf="editedIndex !== i">{{role.name}}</span>
<mdl-textfield *ngIf="editedIndex === i" [(ngModel)]="role.name" class="full-width" value={{role.name}}></mdl-textfield>
</td>
<td>
<span *ngIf="editedIndex !== i">{{role.description}}</span>
<mdl-textfield *ngIf="editedIndex === i" [(ngModel)]="role.description" class="full-width" value={{role.description}}></mdl-textfield>
</td>
<td>
<button *ngIf="editedIndex === i" mdl-button mdl-button-type="mini-fab" mdl-colored="primary" (click)="doSave($event)"
mdl-ripple><mdl-icon>edit</mdl-icon></button>
<button *ngIf="editedIndex === i" mdl-button mdl-button-type="mini-fab" mdl-colored="accent" (click)="doDelete($event, i)"
mdl-ripple><mdl-icon>remove</mdl-icon></button>
</td>
</tr>
Rolle ist ein Modell mit 2 Eigenschaften.
Warum funktioniert es gut in der Laufzeit, aber es ist im Test fehlgeschlagen !!