GithubHelp home page GithubHelp logo

Comments (11)

electricBonfire avatar electricBonfire commented on August 16, 2024 1

+1
Thanks for the work on these packages!

from ng2-file-upload.

mrluc avatar mrluc commented on August 16, 2024 1

@electricBonfire's approach also works for apps created from the angular CLI, with following notes:

  • the entries he mentions are best made in src/system-config.js
  • there needs to be an addition made to angular-cli-build.js to ensure that the module is copied to vendor/ automatically (just add ng2-file-upload/**/*.js

(Also ... grunt, gulp, webpack, brunch. Now, SystemJS. Grr.)

from ng2-file-upload.

piyukore06 avatar piyukore06 commented on August 16, 2024 1

I am using ng2-file-upload with https://github.com/mgechev/angular-seed .. and the following worked for me .. if anyone needs it

this.SYSTEM_CONFIG_DEV.paths['ng2-file-upload'] = `node_modules/ng2-file-upload/ng2-file-upload`;
this.SYSTEM_BUILDER_CONFIG.packages['ng2-file-upload'] = {
  main: `ng2-file-upload.js`,
  defaultExtension : 'js'
};

from ng2-file-upload.

valorkin avatar valorkin commented on August 16, 2024

I have already added this to https://github.com/valor-software/ng2-bootstrap#quick-start
same will be here too soon

from ng2-file-upload.

mwijnands avatar mwijnands commented on August 16, 2024

+1. Also, please provide bundled javascript files to include in the HTML. Right now I have no idea how to use this in my app, which javascript files I need to include, etc. Even though I really want to use it, it looks great.

from ng2-file-upload.

electricBonfire avatar electricBonfire commented on August 16, 2024

@mwijnands I managed to incorporate the lib doing the following:

//index.html
<script>
System.config({
    packages: {
        'js': {
            format: 'cjs',
            defaultExtension: 'js'
        },
        'vendor/ng2-file-upload': {
            format: 'cjs',
            defaultExtension: 'js'
        }
    },
    map: {
        'ng2-file-upload': 'vendor/ng2-file-upload/ng2-file-upload.js',
        moment: 'vendor/moment/moment.js'
    }
});

System.import('/vendor/ng2-file-upload/ng2-file-upload').then(function(){
    System.import('js/boot');
}, console.error.bind(console));
</script>

Note the vendor folder in the map config. I have a script that moves files from node_modules into vendor. You may need to use node_modules/ng2-file-upload/ng2-file-upload.js

Then in my component:

import {FileUploader, FILE_UPLOAD_DIRECTIVES}   from 'ng2-file-upload';

from ng2-file-upload.

valorkin avatar valorkin commented on August 16, 2024

@electricBonfire if you can create a fork or branch or folder with ng2-file-upload sample from here
https://github.com/valor-software/angular2-quickstart
I will really appreciate it :)

from ng2-file-upload.

electricBonfire avatar electricBonfire commented on August 16, 2024

@valorkin I am busy for the next week or so, I will try to put something together when things slow down. If no one else beats me to it!

from ng2-file-upload.

electricBonfire avatar electricBonfire commented on August 16, 2024

@valorkin: https://github.com/electricBonfire/ng2-file-upload-systemjs-quickstart

from ng2-file-upload.

tsuz avatar tsuz commented on August 16, 2024

This is working for me

system.config.js

System.config({
    paths: {
      // paths serve as alias
      'npm:': 'node_modules/',
    },
    // map tells the System loader where to look for things
    map: {
      'ng2-file-upload': 'npm:ng2-file-upload'
    },
    // packages tells the System loader how to load when no filename and/or no extension
    packages: {
      'ng2-file-upload': {
        main: 'index.js',
        defaultExtension: 'js'
      }
    }
  });

in app.module.ts

import { FILE_UPLOAD_DIRECTIVES, FileUploader} from 'ng2-file-upload';

from ng2-file-upload.

igorlino avatar igorlino commented on August 16, 2024

@piyukore06 I also use ng2-file-upload with https://github.com/mgechev/angular-seed , but I found a cleaner way:

//assuming you checkout the angular-seed from scratch
// in project.config.ts
let additionalPackages: ExtendPackages[] = [
      {
        name: 'ng2-file-upload',
        path: 'node_modules/ng2-file-upload/bundles/ng2-file-upload.umd.js'
      }
    ];
    this.addPackagesBundles(additionalPackages);

//in home.module.js  (OPTIONAL)
import { FileUploadModule } from 'ng2-file-upload';
@NgModule({
  imports: [... FileUploadModule ...]
})

//in home.component.js
import { FileUploader } from 'ng2-file-upload';

from ng2-file-upload.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.