2016-06-06 2 views
0

뷰 정보가 포함 된 개체 모델이 있습니다. 이 객체에 대해 몇 가지 변경 작업을 수행 한 다음 적용을 사용하면 슬라이더가 아닌 모든 구성 요소가 업데이트됩니다. 창에서 크기를 조정 한 후에 만 ​​슬라이더가 업데이트 된 것을 볼 수 있습니다. 어떤 생각?적용 후 Slider가 업데이트되지 않음

$rootScope.$on('newPrintSelected', function (event, selectedPrinter) { 
     StorageModule.storage.find(collectionName, {_id : selectedPrinter.printer_hardware._id}, function(error, data){ 
      if (error) { //Not Found 
       console.error("Ops. There is something wrong with this action..."); 
      }else { 
        if(data[0].printOptions == null){ 
         $scope.options = angular.copy($scope.default); 
         $scope.options.layerThickness = 30 - ($scope.options.layerThickness * 100); 
         $scope.persistedOptions = angular.copy($scope.default); 
         $scope.persistedOptions.layerThickness = 30 - ($scope.persistedOptions.layerThickness * 100); 
        }else{ 
         data[0].printOptions.layerThickness = 30 - (data[0].printOptions.layerThickness * 100); 
         $scope.options = angular.copy(data[0].printOptions); 
         $scope.persistedOptions = angular.copy(data[0].printOptions); 
        } 
       } 
       $scope.selectedPrinterHardware = angular.copy(data[0]); 
       console.warn($scope.options); 
       $scope.$apply(); 
      }); 
    }); 

슬라이더 :

<div class="slider"> 
    <rzslider rz-slider-model="options.infill" rz-slider-options="slider.infill"> 

    </rzslider> 
</div> 

$ scope.options 모델로 사용되는 객체입니다. console.warn ($ scope.options); 객체가 정확함을 보여줍니다.

수정 : 슬라이더가 showen 때마다 들어

setTimeout(function(){ $scope.$broadcast('rzSliderForceRender'); }, 25); 

.

문서에 나와 있습니다. 나는 그 일에 대해 유감이다.

+2

관련 코드를 보여주세요. – ajmajmajma

+0

슬라이더는 어디에 있습니까? – Manu

+0

@ajmajmajma 업데이트 됨 –

답변

1

무엇 새로 고침 이벤트 방송에 대한 :

$scope.refreshSlider = function() { 
    $timeout(function() { 
    $scope.$broadcast('rzSliderForceRender'); 
    }); 
}; 

Reference 1Reference 2

+0

나는 문서를 확인하지 않는이 끔찍한 실수를 저질 렀습니다. 나는이 질문에 대해 유감이다. @Manu, 당신의 대답은 저를 도왔습니다. 그러나 저는 그것을 조금 바꿔서 일해야했습니다. 마지막 업데이트를 확인하십시오. –

관련 문제