【发布时间】:2016-12-13 08:25:33
【问题描述】:
<table class="table table-bordered">
<tbody>
<tr ng-repeat="playerOrTeam in template.editableTable track by $index">
<td style="text-align: center;" ng-repeat="playerOrTeamCat in playerOrTeam track by $index">
<input ng-model="playerOrTeamCat" type="text" class="form-control input-sm">
</td>
</tr>
</tbody>
</table>
template.editableTable 是一个多维数组,只填充了标准变量。当我更改输入框中的一个值,然后查看 template.editable 表的输出时,我看不到更改。我错过了什么明显的东西吗?
编辑更多细节,因为我没有收到任何回复 =\
//Template Class
app.factory('Template', function () {
var Template = function () {
/*
* Public Variables
*/
this.editableTable = someMultiDimensionalTable;
}
/*
* Functions
*/
Template.prototype.SeeEditableTableContents = function () {
console.log(this.editableTable);
}
}
//Main Controller
app.controller('MainController', function () {
$scope.template = new Template();
//etc
}
【问题讨论】:
-
对 this.editableTable 进行更改后调用 $scope.digest() 或 $scope.apply() 是否有效?
-
我尝试调用 $scope.apply 并且控制台告诉我它已经被应用 =\
标签: javascript angularjs