在Angularjs中,我想显示从ng-repeat中的模态中选取的文本框中的值。我怎么能这样做?
答案 0 :(得分:0)
在html视图中:
<input ng-model="batchno_qty[$index]">
在控制器中:
$scope.show_qty=function(item_id,index){
$scope.current_index=index;
$scope.batchno_qty1=[];
var modalInstance = $modal.open({
templateUrl: 'opportunities/show_qty_popup.php',
controller: pick_supplier,
scope: $scope,
resolve: {current_index: function () {
return $scope.current_index;
}
}
});
modalInstance.result.then(function (response) {
$scope.response=response;
$scope.batchno_qty=[];
});
}
function pick_supplier($scope, $modalInstance,current_index)
{
$scope.batch_select=[];
$scope.selected_qty=[];
$scope.pick_qty = function (itemid) {
$scope.array_qty=[];
$scope.pick={};
if($scope.batch_select.length==0)
{
Notification.error("No Batch no. is selected.");
}
else
{
for (var i = 0; i < $scope.batch_select.length; i++)
{
if($scope.batch_select[i]==undefined)
{
//Notification("your Batch no. is undefined.");
}
else
{
if($scope.selected_qty[i]==undefined)
{
Notification("Please enter quantity.");
}
else
{
$scope.pick[$scope.batch_select[i]]
=$scope.selected_qty[i];
}
}
}
}
$scope.total_pick=0;
$scope.set=1;
supplier_result.itemid=itemid
$modalInstance.close($scope.pick);
}
}