我的$ scope.Company = 10个项目中有10个数据。我想将记录拆分为两个不同的范围($ scope.companyA和$ scope.companyB),然后我将这些记录绑定到级联下拉列表中。你有什么主意吗 ?我怎样才能做到这一点?
我的记录如下: -
我的记录如下: -
ColA ColB ColC
A AA NULL
B A Test
C B Test2
答案 0 :(得分:0)
我认为你有一个数组,你想将它分成2个数组。
$scope.company = [
{ "Value": "03190F10", "ParentValue": "", "displayValue": "School" },
{ "Value": "32CFC4C7", "ParentValue": "79CF4F14", "displayValue": "Service" },
{ "Value": "360A3825", "ParentValue": "32CFC4C7", "displayValue": "ticket" },
{ "Value": "79CF4F14", "ParentValue": "03190F10", "displayValue": "Customer" },
{ "Value": "Blank", "ParentValue": "", "displayValue": "(Select)" }];
$scope.company2 = $scope.company.slice(0, parseInt($scope.company.length / 2)); // take first half
$scope.company3 = $scope.company.slice(parseInt($scope.company.length / 2), $scope.company.length); // take second half