1

我在 HTML 中初始化了一个中继器 colorSetOne,然后,我想用另一个中继器 colorSetTwo 替换,如何做到这一点(它可以由事件触发)?这是jsfiddle:http: //jsfiddle.net/8xWRm/

HTML:

<ul ng-app ng-controller="cubeCtrl">
<li ng-repeat="color in colorSetOne">{{color}}</li>

Javascipt:

function cubeCtrl($scope){
$scope.colorSetOne = ["red","blue","green","oringe"]
$scope.colorSetTwo = ["blue","red","black","white"]

}

4

1 回答 1

1

你只需要重新分配colorSetOne

$scope.colorSetOne = $scope.colorSetTwo;

如果你想保留,colorSetOne那么你应该把你的转发器放在另一个变量上colorSet,比如根据需要分配适当的颜色集。

于 2013-10-06T06:41:00.847 回答