Upload File Using AngularJS
<html> <head> <script src = “https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js”></script> </head> <body ng-app = “myApp”> <div ng-controller = “myCtrl”> <input type = “file” file-model = “myFile”/> <button ng-click = “uploadFile()”>upload</button> </div> <script> var myApp = angular.module(‘myApp’, []); myApp.directive(‘fileModel’, [‘$parse’, function ($parse) { return { restrict: ‘A’, link: function(scope, element, attrs) { var model = $parse(attrs.fileModel); var modelSetter = model.assign; […]