2016-05-13 36 views
0

页面上刷新刷新下面的代码在我的本地机器上工作,但是当这个代码被推送到远程服务器时,它不能按预期工作。

在这里,我打开一个模板编辑:

<tr class="read" ng-repeat="records in allExportTemplates | orderBy:'-lastRequestDateTime'"> 
    <td class="mail-ontact"> 
    {{records.exportTemplateName}} 
    </td> 
    <td class="mail-subject"> 
    {{records.exportFormat}} 
    </td> 
    <td class=""> 
    <a class="fa fa-cog" data-toggle="modal" ng-click="editTemplate(records)"></a> 
    </td> 

控制器代码editTemplate:

$scope.templateData = {}; 

$scope.editTemplate = function(templateRecords){ 
     $('#someModal').modal('show'); 
     $scope.templateData._id = templateRecords._id; 
     $scope.templateData.companyId = templateRecords.companyId; 
     $scope.templateData.templateName = templateRecords.exportTemplateName; 
     $scope.templateData.exportFormat = templateRecords.exportFormat; 
    } 

,并在下面的代码来更新模板:

<form role="form" name = "edittemplateForm"> 
    <div class="form-group"> 
    <label class="control-label" for="exampleInputEmail1" contenteditable="true">Template Name</label> 
    <input class="form-control" id="exampleInputEmail1" placeholder="Monthly" name="templateName" ng-model="templateData.templateName" ng-required="true"> 
    </div> 
    <div class="form-group"> 
    <label class="control-label" name="selectExportFormat">Select Export Format</label> 
    <select class="form-control" ng-model="templateData.exportFormat"> 
     <option>XML</option> 
     <option>JSON</option> 
    </select> 

外形

<button type="button" class="btn btn-primary" ng-click="updateTemplate(edittemplateForm)" ng-disabled="edittemplateForm.$invalid">Update</button> 

这是控制器的代码来更新:

$scope.updateTemplate = function(editTemplateForm){ 

    someSrv.updateTemplate($scope.templateData) 
    .success(function(response) { 
     if($scope.allExportTemplates.length){ 
      for(i =0;i < $scope.allExportTemplates.length ;i++){ 
       if($scope.allExportTemplates[i]._id == response.data._id){ 
        $scope.allExportTemplates.splice(i,1); 
        break; 
       }     
      } 
      $('#someModal').modal('hide'); 
      $scope.allExportTemplates.push(response.data); 
     } 
    }) 

在更新模板,我除去从阵列中的旧数据。但是,它不会立即显示在页面上,只有在页面刷新后才显示正确的数据。响应包含旧数据,而它在我的本地机器上完美工作,响应具有最新数据,并在隐藏模式后直接显示在页面上。但是,似乎在远程服务器上不起作用。

这个问题的任何线索?

回答

0

得到的解决方案,在这里发布它,以便它可能在未来帮助某人。

这是一个猫鼬相关的问题。升级服务器上的猫鼬版本,做了诀窍。