Within my Angular 2 Component, I have a Dropzone that is created programmatically and I want it to be attached to the body so that my entire website can serve as the "dropzone" for file uploads.
Every time the component is initialized, it attempts to attach the Dropzone.
this.dropzone = new Dropzone('body', this.createOptions());
The first time I run this code, it functions correctly. However, upon navigating back to the component, I encounter the error message "Dropzone already attached."
In my search for a solution, I came across the suggestion of using Dropzone.autoDiscover = false
Unfortunately, attempting this approach results in a TypeScript compilation error: "Left-hand side of assignment expression cannot be a constant or a read-only property."
Therefore, my question is: how can I detach the dropzone from the body and re-attach it when necessary? What steps should I take to implement this functionality?
For my implementation, I am utilizing typings @types/dropzone from https://www.npmjs.com/package/@types/dropzone version 4.3.34
Thank you