试图插补当我用角2 +打字稿,我在选项标签获取楠DOM从阵列ngFor
app.component.ts得到楠:
export class AppComponent {
rooms = {
type: [
'Study room',
'Hall',
'Sports hall',
'department room',
'Service room',
'Restroom']
};
应用。 component.html:
<select placeholder="Select an option">
<option *ngFor="let room-type of rooms.type">{{room-type}}</option>
</select>
我想不通这是怎么回事,因为我不能调试插值和所有的绑定操作,我只是不知道怎么了,谷歌,必应不帮忙!
我使用Visual Studio代码在Windows 10
这就是它的样子:
我认为这是打字稿导致此问题,因为事情是有望获得数量变量,但收到不是数字...
这似乎是一个坏主意,用符号“ - ”在变量名 –