当使用Angular.js从IE-11中的下拉列表中选择值时,站点将被挂起

时间:2016-08-30 13:20:20

标签: javascript angularjs internet-explorer-11

我有一个问题。当用户从下拉列表中选择任何值时,该网站在IE-11中根本不起作用。它在所有其他浏览器中工作。请检查下面的代码。

<select class="form-control" id="answer_{{$index}}_{{$parent.$index}}_category" name="answer_{{$index}}_category" ng-model="answer.category" ng-options="cat.name for cat in listOfCategory track by cat.value" ng-change="removeBorder($index,answer.category.value,$parent.$index)" ng-init="renderWithMode($index,answer.category.value,$parent.$index,isEditMode)">
 <option value="">Select Category</option>
</select>
<select class="form-control" id="answer_{{$index}}_{{$parent.$index}}_subcategory" name="answer_{{$index}}_subcategory" ng-model="answer.subcategory" ng-options="sub.name for sub in listOfSubCategory[$parent.$index][$index] track by sub.value">
<option value="">Select Subcategory</option>
</select>

控制器端代码如下所示。

$http({
        method:'GET',
        url:"php/customerInfo.php?action=cat",
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    }).then(function successCallback(response){
        console.log('res',response.data);
        angular.forEach(response.data,function(obj){
            var data={'name':obj.cat_name,'value':obj.cat_id};
            $scope.listOfCategory.push(data);
        })
    },function errorCallback(response) {
    })

$scope.removeBorder=function(index,catvalue,parent,com){

     // answer_{{$index}}_{{$parent.$index}}_comment
     // console.log('ind',index,catvalue,parent,document.getElementById('answer_'+index+'_'+parent+'_comment').value);
     //$scope['listOfSubCatagory'+parent][index]=[];
    //$scope.listOfSubCatagory[index][parent]=[[]];
    //$scope.listOfSubCatagory[index] = []
   // $scope.listOfSubCatagory[index][parent] = []
   var subcategories=[];
     var catdata=$.param({'action':'subcat','cat_id':catvalue});
        $http({
            method:'POST',
            url:"php/customerInfo.php",
            data:catdata,
            headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
        }).then(function successCallback(response){
            angular.forEach(response.data,function(obj){
                var data={'name':obj.subcat_name,'value':obj.subcat_id};
                if(!$scope.listOfSubCategory[parent]){
                      $scope.listOfSubCategory[parent] = [];  
                }
                //console.log('data',data);
                subcategories.push(data);
            })
            $scope.listOfSubCategory[parent][index]=subcategories;
        },function errorCallback(response) {
        }) 
  }

这里有两个下拉列表。当用户选择类别时,相应的子类别应该在第二个下拉列表中设置。它在所有其他浏览器中工作正常但在IE-11中选择子类别时丢弃下面的列表该网站正在被绞死。请帮我解决这个问题。

0 个答案:

没有答案