我使用Angular 2 + TypeScript,我在选项标签中获得NaN
app.component.ts:
export class AppComponent {
rooms = {
type: [
'Study room',
'Hall',
'Sports hall',
'department room',
'Service room',
'Restroom']
};
app.component.html:
<select placeholder="Select an option">
<option *ngFor="let room-type of rooms.type">{{room-type}}</option>
</select>
我无法弄清楚发生了什么,因为我无法调试插值和所有绑定操作,我只是不知道如何,而且Google-Bing没有帮助!
我在Windows 10上使用Visual Studio Code。
这就是它的样子:
我认为这是造成这个问题的TypeScript,因为预计某些内容会获得数字变量,但不会收到数字......
答案 0 :(得分:7)
不要在变量名称中使用<hf:chart type="line" value="#{lineChartBean.boys}" var="birth"
xaxisLabel="Years" point="#{birth.amount}"
tickLabel="#{birth.year}" title="List of Pojos" />
。它在JS / TS中是不允许的,所以它也不允许用于模板化。它会尝试减去并导致-
(不是数字):
NaN