在angularjs中缺少绑定值

时间:2014-04-06 15:27:11

标签: javascript angularjs

http://plnkr.co/edit/hLsMPWp6O2uL4SheThLR?p=preview

我在index.html

中使用push但{{tab.tabName}}返回空白(第46行)

2 个答案:

答案 0 :(得分:1)

in app.js

替换:

$scope.tabs.push({
    "tabId": tabId = tabId + 1,
    "name" : capitaliseFirstLetter(this.NewTabName),
    "active" : true
});

$scope.tabs.push({
    "tabId": tabId += 1,
    "tabName" : capitaliseFirstLetter(this.NewTabName),
    "active" : true
});

答案 1 :(得分:0)

这是你的问题:(在app.js中,在addTab函数下)

"name" : capitaliseFirstLetter(this.NewTabName),

应该是:

"tabName" : capitaliseFirstLetter(this.NewTabName),