업로드 코드:
변수 이름은 res i라는 문자열로 구성되는데, 이는 res1--res6입니다. $scope 뒤에 연결된 변수 이름을 연결하는 방법은 무엇입니까? $scope.res i 또는 $scope[res i]는 작동하지 않습니다
답변 감사합니다. 최종 답변은 변수 연결을 클릭할 수 없다는 것입니다.
ringa_lee
$scope[res] = xxxxx;
for (var i = 1; i 으아악
}
먼저 res는 배열이어야 합니다. $scope.res=[];
for (var i = 1; i < 7; i++) {$scope.res.push('res'+i);}
아마 이렇게 썼을 거예요.
$scope["res"+i] 이렇게 쓰면 됩니다
$scope[res] = xxxxx;
for (var i = 1; i 으아악
}
먼저 res는 배열이어야 합니다.
$scope.res=[];
for (var i = 1; i < 7; i++) {
$scope.res.push('res'+i);
}
아마 이렇게 썼을 거예요.
$scope["res"+i] 이렇게 쓰면 됩니다