1.0.4 • Published 7 years ago

ng-files-model v1.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

ng-files-model


Angular File Model is a directive for angularjs to help you make a model for input file and you can send it to sever for next step.

Installation

npm

npm install ng-files-model --save

Model

Result or return are :

  • lastModified : js millisecond date
  • lastModifiedDate : js date
  • name : file name
  • size : file size
  • type : file type
  • data : data url base64 of the file

Usage

on application : angular.module("myApp", ["ng-files-model"])

on html : <input type="file" ng-files-model model="testFile" callback="function" data="data" multiple="mulplite" />

Result :

{
    "lastModified": 1475607121292,
    "lastModifiedDate": "2015-08-03T06:39:32.000Z",
    "name": "ng-files-model.txt",
    "size": 32,
    "type": "text/plain",
    "file": "VXBsb2FkIGZpbGVzIG1vZGVsIHdpdGggYW5ndWxhcgo="
}

Parâmetros

parametrotipodescriçãoobrigatóriopadrão
callbackfunctionfunção executada após conversão dos arquivosnão
dataobjectObjeto enviado como segundo parãmetro na função callbacknão
multipletagTag html para multiplos arquivosnão
modelarrayobjectArray ou objeto que recebe o resultadonão

Code inspired from https://github.com/mistralworks/ng-file-model