如何在文本框中获取从angularjs模式中选取的值?
在Angularjs中,我想在文本框中显示从ng repeat中的modal中拾取的值。如何执行此操作?在html视图中:如何在文本框中获取从angularjs模式中选取的值?,angularjs,Angularjs,在Angularjs中,我想在文本框中显示从ng repeat中的modal中拾取的值。如何执行此操作?在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({
<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);
}
}
$scope.show\u qty=功能(项目id,索引){
$scope.current_index=索引;
$scope.batchno_qty1=[];
var modalInstance=$modal.open({
templateUrl:'opportunities/show_qty_popup.php',
控制员:挑选供应商,
范围:$scope,
解析:{当前索引:函数(){
返回$scope.current_索引;
}
}
});
modalInstance.result.then(函数(响应){
$scope.response=响应;
$scope.batchno_数量=[];
});
}
功能选择供应商($scope、$modalInstance、当前索引)
{
$scope.batch_select=[];
$scope.selected_数量=[];
$scope.pick_qty=函数(itemid){
$scope.array_数量=[];
$scope.pick={};
如果($scope.batch\u select.length==0)
{
通知。错误(“未选择任何批次号”);
}
其他的
{
对于(变量i=0;i<$scope.batch\u select.length;i++)
{
如果($scope.batch_select[i]==未定义)
{
//通知(“您的批号未定义”);
}
其他的
{
如果($scope.selected_数量[i]==未定义)
{
通知(“请输入数量”);
}
其他的
{
$scope.pick[$scope.batch\u select[i]]
=$scope.selected_数量[i];
}
}
}
}
$scope.total_pick=0;
$scope.set=1;
供应商\结果。项目ID=项目ID
$modalInstance.close($scope.pick);
}
}
在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);
}
}
$scope.show\u qty=功能(项目id,索引){
$scope.current_index=索引;
$scope.batchno_qty1=[];
var modalInstance=$modal.open({
templateUrl:'opportunities/show_qty_popup.php',
控制员:挑选供应商,
范围:$scope,
解析:{当前索引:函数(){
返回$scope.current_索引;
}
}
});
modalInstance.result.then(函数(响应){
$scope.response=响应;
$scope.batchno_数量=[];
});
}
功能选择供应商($scope、$modalInstance、当前索引)
{
$scope.batch_select=[];
$scope.selected_数量=[];
$scope.pick_qty=函数(itemid){
$scope.array_数量=[];
$scope.pick={};
如果($scope.batch\u select.length==0)
{
通知。错误(“未选择任何批次号”);
}
其他的
{
对于(变量i=0;i<$scope.batch\u select.length;i++)
{
如果($scope.batch_select[i]==未定义)
{
//通知(“您的批号未定义”);
}
其他的
{
如果($scope.selected_数量[i]==未定义)
{
通知(“请输入数量”);
}
其他的
{
$scope.pick[$scope.batch\u select[i]]
=$scope.selected_数量[i];
}
}
}
}
$scope.total_pick=0;
$scope.set=1;
供应商\结果。项目ID=项目ID
$modalInstance.close($scope.pick);
}
}
您能告诉我们到目前为止您有什么吗?如果您使用angular bootstrap UI,您可以很容易地做到这一点,正如这里所解释的-这是不可能回答的,太笼统了。我能提供的最好答案是:1。从模式中获取值。2.绑定到文本字段模型。请给我一个例子,你如何绑定到文本字段模型,你如何从ng repeat中选择值…请再详细说明一下,你能告诉我们你到目前为止得到了什么吗?如果你使用角度引导用户界面,你可以很容易地做到这一点,正如这里所解释的-这是不可能回答的,太笼统了。我能提供的最好答案是:1。从模式中获取值。2.绑定到文本字段模型。请给我一个例子,你是如何绑定到文本字段模型的,你是如何从ng repeat中选取值的……请再详细说明一下