javascript - GetElementById equivalant in angular js -


<div>     <input id="txt"  type="text" placeholder="choose file" />     <input type="file" id="selectedfile" class="hidden" onchange="changetext(this, 'txt');" />     <span>         <button type="button" onclick="document.getelementbyid('selectedfile').click();">browse</button>     </span> </div> 

i want on-click event in angular js. can tell?

i want on-click event in angular js. can tell? code in comment

okay, before might not have read question fully. have, , think you're looking for: https://plnkr.co/edit/pfju5b17qczwhkog4itn?p=preview

.controller('upload', ['$scope', function($scope) {     this.input;      this.browse = function() {         this.input.click();     }; }]) .directive('fileupload', [function() {     return {         'restrict':'e',         'controller':'upload',         'controlleras':'upload',         'templateurl': './upload.html',         'link':function($scope, $element, $attribute, upload) {             upload.input = $element.find('input')[1];         }     }; }]); 

in link-function of directive injected input controller. controller fires click-event node, calling file-browser.

edit: not use input show file, show more generic listing of selected files, preview if possible. way have use first input :)

sorry not reading question better, hope helps.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -