npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ng2-file-upload-modal

v1.0.0

Published

This angular 2 component adds a link to your html, that when clicked displays a modal with a file upload component.

Downloads

4

Readme

ng2-file-upload-modal

This angular 2 component adds a link to your html, that when clicked displays a modal with a file upload component. It uses the ng2-file-upload component thats then added to the ng2-bs3-modal component. Even though the ng2-file-upload supports multiple files, this component is designed to cater for single file upload.

Install

Install all the dependencies:

npm install --save ng2-bs3-modal
npm install --ng2-file-upload
npm install --save ng2-file-upload-modal

Usage

ng2-bs3-modal depends on bootstrap which depends on jquery, you'll need to include both scripts:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.js"></script>

If you're using SystemJS, add the below mappings for all the required dependencies. For a production app these libraries needs to be loaded from a cdn location.

System.config({
    defaultJSExtensions: true,
    map: {
        'ng2-bs3-modal': 'node_modules/ng2-bs3-modal',
        'ng2-file-upload': 'node_modules/ng2-file-upload',
        'ng2-file-upload-modal': 'node_modules/ng2-file-upload-modal'
    }
});

Then import and include in your component:

import {Ng2FileUploadModal} from 'ng2-file-upload-modal/ng2-file-upload-modal';

@Component({
    directives: [Ng2FileUploadModal]
})
export class MyComponent {
    ...
}

Add the directive to your html with the specified bindings:

<ng2-file-upload-modal
    title="Your title"
    [uploadUrl]="yourRestUrl"
    (uploadStatus)="yourCallback($event)">
</ng2-file-upload-modal>

Config

The link that's added to your html can be styled using the 'uploadButton' css selector.

Build

This component uses gulp to build itself. Run the 'build' task to build it locally. The source is build in place, meaning that the typescript compiler produces js & d.ts files alongside the original ts files. The 'bundle' task then outputs everything into a single js file located in bundles folder.

Run

The 'play' task starts up a webserver and opens the app in your default browser.