【发布时间】:2016-10-03 21:57:19
【问题描述】:
无法告诉我在这里做错了什么。尝试通过 CORE_DIRECTIVES 明确定义 ngFor 指令,并使用 let。有什么我错过的吗?
import { Component, Input , Output , EventEmitter} from 'angular2/core';
import {CORE_DIRECTIVES, FORM_DIRECTIVES} from 'angular2/common';
@Component({
selector: 'panel',
moduleId: module.id,
templateUrl: './panel.component.html',
styleUrls: ['./panel.component.css'],
directives: [FORM_DIRECTIVES, CORE_DIRECTIVES]
})
export class panelComponent {
list: String[];
}
在所有 ngFors 上出现错误
<ul >
<li *ngFor="let thing of list">
<p>{{thing}}</p>
</li>
</ul>
【问题讨论】:
-
你使用的是哪个 Angular2 版本?
标签: html typescript angular