2014-02-28 2 views

답변

0

약간의 도움이 될 수 있습니다 내가 찾은 링크의 몇 가지 : 예를 들어 http://api.jquery.com/file-selector/ jQuery: get the file name selected from <input type="file" />

이 노래에서 유사

<input name="posterTitle" type="text" ng-model="posterTitle"> 
{{posterTitle}} 

이름 또는 ID 속성 :

$ ('input [type = file]'). 변경 (함수 (e) { $ in = $ (this); $ in.next() .html ($ in.val()); }});

+0

저는 실제로 각도 접근 방식을 찾고있었습니다. 각도 컨트롤러에서 파일 이름과 비교할 필요가 있습니다. – magnum

0

Angularjs를 사용하면 onchange 이벤트를 사용하여 컨트롤러 내부에서 입력 이름을 바인딩해야 할 수 있습니다. 예를 참조하십시오

<input name="posterFileName" type="file" onchange="angular.element(this).scope().fileName(this)"/> 

이 도움이 될 것입니다 희망

$scope.fileName= function(element) { 
    $scope.$apply(function($scope) { 
     $scope.posterTitle= element.files[0].name; 
    }); 
}; 

컨트롤러 내부.

관련 문제