2016-08-05 4 views
0

데스크톱에서 CSS 파일을 가져 오기 위해 ng-csv-import를 사용했으며 csv를 업로드하는 제출 버튼이 있습니다. 사용자가 CSS 파일을 선택할 때까지 제출 단추를 사용하지 않도록 설정해야합니다. 미리 감사드립니다.각도 js에서 csv 가져 오기에서 버튼 사용 안함

<ng-csv-import name="uploadCsv" content="MyCsv" 
       separator="csv.separator" 
       result="csv.results" 
       accept="csv.accept" required> 
</ng-csv-import> 
<div class="col-xs-12 col-sm-12"> 
    <button type="submit" class="btn-top btn-rectangle" ng-click="submit()">Submit</button> 
</div> 

답변

1

당신과 같이 버튼 NG 장애인 사용할 수 있습니다

<button type="submit" class="btn-top btn-rectangle" ng-click="submit()" ng-disabled="yourDisabledVariable">Submit</button> 

그런 다음 컨트롤러에서 NG-CSV 가져 오기 내용

//Default is disabled 
$scope.yourDisabledVariable = true; 
// Watch for changes on $scope.MyCsv 
$scope.$watch('MyCsv', function(newVal,oldVal){ 
    // see if user uploaded a csv by looking at $scope.MyCsv 
    if(newVal){ 
     // Enable the button 
     $scope.yourDisabledVariable = false; 
    } 
}) 
+0

감사에 대한보고. 괜찮 았어. – Warrior

-1

시도해 볼 수 있습니다.

$('input[type="submit"]').prop('disabled', true); 
    $('input[type="text"]').keyup(function() { 
     if($(this).val() != '') { 
      $('input[type="submit"]').prop('disabled', false); 
     } 
    }); 
관련 문제