在我的表单中,我将范围内的模型传递给这样的行为:
<a href="#"
ng-click="removeAnEditSelectionFromModelCollection(data.editAction.actionType1.actionsRecommendedByLer, actionRecommendedByLer.lookUpDetailId, 'editActionRecommendedByLerSelect')"
class="functionalLinks text-danger">
<i class="glyphicon glyphicon-trash"></i>
DELETE
</a>
该模型是一个Angular数组: $ scope.data.editAction.actionType1.actionsRecommendedByLer
接收功能如下所示:
$scope.removeAnEditSelectionFromModelCollection = function (modelCollection, lookUpDetailId, selectId) {
console.log("In removeAnEditSelectionFromModelCollection");
modelCollection
= $.grep(modelCollection,
function (n, i) {
console.log("n.lookUpDetailId: " + n.lookUpDetailId + ", lookUpDetailId: " + lookUpDetailId);
return (n.lookUpDetailId !== lookUpDetailId);
}
)
console.log("modelCollection.length: " + modelCollection.length);
var element = $('#' + selectId + ' option[value = "' + lookUpDetailId + '"]');
// console.log(element.text());
element.removeAttr('disabled');
element.css('background-color', '');
}
好像它是通过值传递的。我可以通过某种方式通过引用传递这个,所以在grep我的表与Angular数组的ng-repeat将反映更新?