Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 使用select2()在下拉列表中显示所选选项_Jquery_Angularjs_Select2_Angularjs Select2 - Fatal编程技术网

Jquery 使用select2()在下拉列表中显示所选选项

Jquery 使用select2()在下拉列表中显示所选选项,jquery,angularjs,select2,angularjs-select2,Jquery,Angularjs,Select2,Angularjs Select2,我有两个下拉选择框,我使用AngularJS在下拉框中显示选项 在我的脚本中使用$(“.select2\u demo\u 1”).select2()一次只有一个下拉列表显示选定的选项。我想显示两个下拉列表以显示选定的选项。我需要帮助 <select id="one" class="select2_demo_1 form-control" ng-model="orgs" ng-options="item.OrganizationTypeTitle for item in organizati

我有两个下拉选择框,我使用AngularJS在下拉框中显示选项

在我的脚本中使用
$(“.select2\u demo\u 1”).select2()一次只有一个下拉列表显示选定的选项。我想显示两个下拉列表以显示选定的选项。我需要帮助

<select id="one" class="select2_demo_1 form-control" ng-model="orgs" ng-options="item.OrganizationTypeTitle for item in organization"></select>
<select id="two" class="select2_demo_1 form-control" ng-model="industry" ng-options="i.IndustryTypeTitle for i in industries"></select>

var getOrganizationTypes = OrgService.getOrganizationTypes();

getOrganizationTypes.then(function (response) {
    $scope.organization = response.data;
    $scope.orgs = $scope.organization[0];

}, function () {
    alert('can not get Organization Types!');
});

var getIndustryTypes = OrgService.getIndustryTypes();

getIndustryTypes.then(function (response) {

    $scope.industries = response.data;
    $scope.industry = $scope.industries[0];

}, function () {

    alert('can not get industry types');

})

var getOrganizationTypes=OrgService.getOrganizationTypes();
getOrganizationTypes.then(函数(响应){
$scope.organization=response.data;
$scope.orgs=$scope.organization[0];
},函数(){
警报('无法获取组织类型!');
});
var getIndustryTypes=OrgService.getIndustryTypes();
getIndustryTypes.then(函数(响应){
$scope.industries=response.data;
$scope.industry=$scope.industries[0];
},函数(){
警报(“无法获取行业类型”);
})

您需要一个循环来从相同的css获取值

      $(function () { 
        var v = [];
        $(".select2_demo_1").each(function(){
            v.push($(this).val());
        })  
      });
样本:


1.
2.
3.
4.
1.
2.
3.
4.
获得价值
设定值
$(“.getValue”)。单击(函数(){
var v=[];
$(“.select2\u demo\u 1”).each(function(){
v、 推送($(this.val());
警报($(this.val())
})  
});

您需要一个循环来从相同的css获取值

      $(function () { 
        var v = [];
        $(".select2_demo_1").each(function(){
            v.push($(this).val());
        })  
      });
样本:


1.
2.
3.
4.
1.
2.
3.
4.
获得价值
设定值
$(“.getValue”)。单击(函数(){
var v=[];
$(“.select2\u demo\u 1”).each(function(){
v、 推送($(this.val());
警报($(this.val())
})  
});