ngFileReader

This is file reader component on angular.
Homepage:
2 people use it
Submitted by: C1a1667c77d27e39e9969d3cb8a91c37?d=https%3a%2f%2fidenticons.github.com%2f1dd37bc234b1fd2c2733ccfdf10d3d60 SparrowJang

ngFileReader

demo image

This is file reader component on angular.

LiveDemo

demo

Support

  • IE8+
  • chrome
  • firefox

Dependency

You need load jQuery and FileReader if browser is not support FileReader.

And The base64 size only limit 32kb if you use base64 to set image on IE8.

Install

Usage

Set some attrs of element. ```

size:{{file.size | fileSize}}

```

Set a reader method. $scope.readMethod = "readAsDataURL";

Add a on-readed callback to set file size and img data. ``` $scope.onReaded = function( e, file ){

$scope.img = e.target.result; $scope.file = file; }; ```

Attr

filereader

This is swf path, if you use ie8 ~ ie9.

multiple

Input multiple property/

debug-mode

Use swf only.

ex:

Set the attr on tag.

Parameter

read-method

This is file reader method,when you selected file to call read-method method.

ex: readAsDataURLreadAsTextreadAsBinaryString

Set the attr. read-method="readMethod"

Set a string value. $scope.readMethod = "readAsDataURL"

Event

on-selected Event

It will trigger this event if you has selected.

on-readed Event

It will trigger this event When the selected file has readed by file reader.

Run

run a server: grunt server

Finally,open your brower,enter http://localhost:3000/example/index.html.

comments powered by Disqus
This page was last updated about 3 years ago.