我试图在不使用ng-model的情况下从组件控制器访问fileInput,textInput的值。但我没有定义。
<form name="uploadForm">
<div layout-gt-sm="row">
<input id="fileInput" type="file" class="ng-hide">
<md-input-container md-no-float class="md-block">
<input id="textInput" type="text" placeholder="No file chosen" ng-readonly="true" required current-dir="$ctrl.currentDir">
</md-input-container>
<md-button id="uploadButton" class="md-raised md-primary">Choose file</md-button>
<md-button id="saveButton" class="md-raised md-primary" ng-click="$ctrl.uploadVideoFile($event)" >Upload</md-button>
</div>
</form>
var input = $(element[0].querySelector('#fileInput'));
var button = $(element[0].querySelector('#uploadButton'));
var textInput = $(element[0].querySelector('#textInput'));
答案 0 :(得分:1)
试试这个
var input = angular.element('#fileInput');