javascript - FileReader() is not defined in Angularjs Directive -


i working on file upload functionality on ui. basically, on ui page, need read file contents , display when user selects local file his/her machine. this, googled , found http://plnkr.co/edit/eeqbr65oe8iljm7ueghx?p=preview example. working fine. used in application, not working , giving me error that"filereader" not defined.

here example:

function onreadfile($parse) {     return {         restrict: 'a',         scope: false,         link: function(scope, element, attrs) {             var fn = $parse(attrs.onreadfile);              element.on('change', function(onchangeevent) {                 var reader = new filereader();                  reader.onload = function(onloadevent) {                     scope.$apply(function() {                         fn(scope, {$filecontent:onloadevent.target.result});                     });                 };                  reader.readastext((onchangeevent.srcelement || onchangeevent.target).files[0]);             });         }     }; } 


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -