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AC;QAC/B,MAAM,CAAC,SAAS,CAAC;IACnB,CAAC;IACH,uBAAC;AAAD,CAlCA,AAkCC,IAAA;AAlCY,4CAAgB","file":"webparts/angularFileUpload/app/directives/customFileChange.js","sourcesContent":["import { IFile } from \"../../interfaces/IFile\";\r\nexport class CustomFileChange implements ng.IDirective {\r\n constructor(private $parse: ng.IParseService) {\r\n\r\n }\r\n\r\n public restrict = \"A\";\r\n public link = (scope: ng.IScope, element: any, attrs: any) => {\r\n const model = this.$parse(attrs.customFileChange);\r\n const modelSetter = model.assign;\r\n element.bind(\"change\", (): void => {\r\n scope.$apply((): void => {\r\n const reader = new FileReader();\r\n\r\n reader.onload = (event: any): void => {\r\n const fileModel: IFile = {\r\n fileName: element[0].files[0].name, \r\n fileAsBuffer: event.target.result\r\n };\r\n modelSetter(scope, fileModel);\r\n };\r\n\r\n reader.onerror = (event: any): void => {\r\n alert(event.target.error);\r\n };\r\n reader.readAsArrayBuffer(element[0].files[0]);\r\n });\r\n });\r\n };\r\n\r\n public static factory(): ng.IDirectiveFactory {\r\n const directive = ($parse: ng.IParseService) => new CustomFileChange($parse);\r\n directive.$inject = ['$parse'];\r\n return directive;\r\n }\r\n}"],"sourceRoot":"..\\..\\..\\..\\..\\src"}