我只是在名稱爲coordinatorName
的網格中再添加一列。爲此,我根據需要修改了WebApi並查看了數據,這很好。我有Angular2
問題。innerText不適用於一列 - 無法綁定到'innertext',因爲它不是已知屬性
組件
export class WorkflowActivity{
activityName: string;
assigneeName: string;
coordinatorName: string;
serviceName: string;
createdDate: Date;
dueDate: Date;
status: string;
isSelected: boolean;
isCritical: boolean;
isForwarded: boolean;
}
你可以看到我已經添加了一個列有。並在Html
。
佈局
<tr *ngFor='let activity of pagedWorkflowActivities'>
<td [innerText]='activity.assigneeName'>
</td>
<td [innertext]='activity.coordinatorName'>
</td>
<td>
<i class="fa" [ngClass]="{'fa-exclamation-triangle warning': activity.isCritical, 'fa-share sky': activity.isForwarded}"
aria-hidden="true"></i> {{activity.serviceName}}
</td>
<td [innerText]='activity.activityName'>
</td>
<td [innerText]='activity.createdDate | date: "dd/MM/yyyy"'>
</td>
</tr>
我已籤pagedWorkflowActivities
被填充新列,還是我得到這個錯誤。
EXCEPTION: Uncaught (in promise): Error: Template parse errors: Can't bind to 'innertext' since it isn't a known property of 'td'. ("eName'> ][innertext]='activity.coordinatorName'> "): [email protected]:44 Error: Template parse errors: Can't bind to 'innertext' since it isn't a known property of 'td'. ("eName'> ][innertext]='activity.coordinatorName'> "): [email protected]:44 at TemplateParser.parse (http://localhost/HelixWebApp/angular/node_modules/@angular/compiler/bundles/compiler.umd.js:8530:21) at RuntimeCompiler._compileTemplate (http://localhost/HelixWebApp/angular/node_modules/@angular/compiler/bundles/compiler.umd.js:16905:53) at eval (http://localhost/HelixWebApp/angular/node_modules/@angular/compiler/bundles/compiler.umd.js:16828:85) at Set.forEach (native) at compile (http://localhost/HelixWebApp/angular/node_modules/@angular/compiler/bundles/compiler.umd.js:16828:49) at ZoneDelegate.invoke (http://localhost/HelixWebApp/angular/node_modules/zone-js/dist/zone.js:232:26) at Object.onInvoke (http://localhost/HelixWebApp/angular/node_modules/@angular/core/bundles/core.umd.js:6242:41) at ZoneDelegate.invoke (http://localhost/HelixWebApp/angular/node_modules/zone-js/dist/zone.js:231:32) at Zone.run (http://localhost/HelixWebApp/angular/node_modules/zone-js/dist/zone.js:114:43) at http://localhost/HelixWebApp/angular/node_modules/zone-js/dist/zone.js:502:57
雖然如果我使用{{ }}
對於像
<td>{{activity.coordinatorName}}</td>
爲什麼它不工作的innerText正常工作?我需要爲該列做任何設置嗎?