Search code examples
javascriptangularangular5angular6angular4-forms

How to stop to open new content in angular ngx-input-file


I am using angular ngx-input-file for drag and upload images. But in this module, If i drag and drop the image in a placeholder, it will automatically open the new placeholder to drag and drop.

I don't want to open the new placeholder. If i drag and drop the image, it should upload the image and could not open the new content. How can I hide or how can i remove that functionality. Please help me to do this.

Please look at the below example,

stackblitz


Solution

  • do you mean that when you drag an image to the first placeholder, you don't want the second placeholder to appear?

    If so, set fileLimit to 1. That should do it.

    <input-file inputId="input-file" fileAccept="image/*" fileLimit="1" placeholder="Pictures"></input-file>
    

    Also in your app-component.ts, you will see a default config. Set the limit their to 1 if you want that to be your stand behaviour.