Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
AngularJS基于其他td修改td_Angularjs_Angularjs Ng Repeat - Fatal编程技术网

AngularJS基于其他td修改td

AngularJS基于其他td修改td,angularjs,angularjs-ng-repeat,Angularjs,Angularjs Ng Repeat,我有一个通过ng repeat控制的对象。其中一个元素是textfield,我在$scope上有一个函数,它返回文本行数。现在,在同一行中的另一行上,我想添加尽可能多的选择框,因为我在文本字段中有行,所以我尝试了以下方法: 选择: {{variable.extras}} -默认技能- 我只得到第二列中的一个元素。当我更改该文本字段的内容时,如何使其重新计算?您需要将数量值转换为数组。这样做应该可以: $scope.getNumArray = function(num) { return

我有一个通过ng repeat控制的对象。其中一个元素是textfield,我在$scope上有一个函数,它返回文本行数。现在,在同一行中的另一行上,我想添加尽可能多的选择框,因为我在文本字段中有行,所以我尝试了以下方法:

选择: {{variable.extras}} -默认技能-
我只得到第二列中的一个元素。当我更改该文本字段的内容时,如何使其重新计算?

您需要将数量值转换为数组。这样做应该可以:

$scope.getNumArray = function(num) {
    return new Array(num);   
}

您可以在numberOfRowsForChoiceVariablevariable中使用此函数来返回数组,而不是整数。

numberOfRowsForChoiceVariable是什么样子的?它根据变量中的行数返回我希望存在的数字选择框。extras Model tr应该是一个ng重复,只循环正确的数字好几次了。但是问题仍然存在,当variable.extras发生变化时,我如何重写td元素?可能需要创建一个小提琴,以便我们可以看到发生了什么。这是一个开始。我将它从element repeat=更改为numberOfRowsForChoiceVariablevariable track by$index中的ng repeat=x,它返回如您所示的数组。虽然我的页面上只有一个select元素。