配列$scope.multiRoles
があります。削除ボタンをクリックしてその値を削除する必要があります。削除された値は別の配列$scope.role
に移動する必要があります。 removeRole()
を呼び出して配列を削除できましたが、削除した値を別の配列に移動できませんでした。手伝いが必要。1つの配列から値を削除して別の配列に移動する
HTML:
<div ng-if="rolesAdded" class = "col-sm-12 col-xs-12">
<span class="tag label tagStyle newStyling" value ="data" ng-repeat="data in multiRoles track by $index">
<span>{{data}}</span>
<a><i ng-click="removeRoles(index)"class="remove glyphicon glyphicon-remove-sign "></i></a>
</span>
</div>
JS:
$scope.removeRoles = function(index){
if(($scope.multiRoles!== null) && ($scope.multiRoles.length>1)) {
$scope.multiRoles.splice(index,1);
}
$scope.rolesAdded = true;
};
重複(http://stackoverflow.com/questions/39911601 – DieuNQ