Socket
Socket
Sign inDemoInstall

angular-media-preview

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    angular-media-preview

create a preview for each media present in input type file


Version published
Maintainers
1
Install size
646 kB
Created

Readme

Source

angular-media-preview

create a preview for each selected file

Getting started:

Change to the directive file with your module appname.

angular.module('myApp')

  .directive(...)

and load the script it in your HTML.

<script type="text/javascript" src="mediapreview.directive.js"></script>

Basic setup:

Add the directive to input where you want to listen.

<input type="file" ng-model="myUpload" media-preview>

Now when some files are selected, the directive will create a preview and display in a container. You can specify a custom container adding the attribute: preview-container, like so:

<input type="file" ng-model="myUpload" preview-container="myContainer" media-preview>

The directive will add or override the accept attribute to match only the following accepted media types: audio, image, videos.

And that's it, with this basic configuration you can start trying it by selecting some media file on your computer.

Customizations:

  • preview-container: the container that holds the preview elements
  • container-class: the class to be added to the preview container
  • preview-class: the class to be added to the preview element

If one of the attributes above is specified will override the default behaviours.

IMPORTANT: be sure to have a model bind to your input (attribute ng-model), otherwise the directive will not work!

The directive takes care to update your model value, so you don't have to write your own one.

Check the example too see how it works!

Developed by codekraft-studio

Keywords

FAQs

Last updated on 06 Feb 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc