How to Write data to file in angularJS

index.html
----------
<div ng-controller="MyCtrl">
  <input type="file" id="fileid" name="fileid"/>
  <br>
  <button ng-click="addfile()">Add_Button</button>
  <p>{{myfilecontent}}</p>
</div>


App.js
------
var myApp = angular.module('myApp',[]);

function MyCtrl($scope) {
    $scope.myfilecontent = 'Here....';
    $scope.addfile = function(){
      var f = document.getElementById('fileid').files[0],
          r = new FileReader();
      r.onloadend = function(e){
        $scope.myfilecontent = e.target.result;
      }
      r.readAsBinaryString(f);
    }
}


EmoticonEmoticon