Comments (4)
Haven't seen such behavior so can't say what could be wrong. The styles are inlined within the component so can't think of anything that would cause them not to work. If you are using a directive then you need to load the style file separately, but not with component.
from ngx-dropzone-wrapper.
It seems that setting ViewEncapsulation.None
or if you now your target browsers ViewEncapsulation.Native
in the component which uses DropzoneComponent
fixes that problem.
Probably angular's default is ViewEncapsulation.Emulated
due to browser compatibility because ViewEncapsulation
seems to be solved through shadow dom.
from ngx-dropzone-wrapper.
We've wrapped DropzoneComponent
into a custom component, copied the styles from this package and imported dropzone
styles directly from node_modules
. At the end this approach gives us full access to the styles.
import { DropzoneComponent } from 'ngx-dropzone-wrapper';
import {
Component,
ViewEncapsulation,
OnDestroy
} from '@angular/core';
@Component({
selector: 'my-dropzone',
templateUrl: './my-dropzone.component.html',
styleUrls: [
'../../../../../../node_modules/dropzone/dist/min/dropzone.min.css',
'./ngx-dropzone-wrapper.scss',
'./my-dropzone.scss',
],
encapsulation: ViewEncapsulation.None
})
export class MyDropzoneComponent extends DropzoneComponent implements OnDestroy {
ngOnDestroy() {
if (this.dropzone) {
this.dropzone.destroy();
}
}
}
A little bit hacky, but it works for now.
btw.: Overriding ngOnDestroy
solved also #23 for us.
from ngx-dropzone-wrapper.
Yes thats how the style encapsulation works in Angular. You could always make your own styles fully and not use the Dropzone styles file, then you can do it without the ViewEncapsulation.None, but if you want to use the dropzone styles in your own component you need to have the ViewEncapsulation.None. If you import the styles in the global styles then I think it should also work without the ViewEncapsulation change.
Btw. the latest version should have the check in destroy so there should not be need for overriding.
from ngx-dropzone-wrapper.
Related Issues (20)
- New 5.6.0 version of dropzone causing build errors with all versions of ngx-dropzone-wrapper HOT 3
- Ngxs with dropzone
- Remove file link resets entire form HOT 1
- how to pass filename on parameter HOT 1
- orientation not working when uploading an image only in chrome browser. HOT 1
- how to stop the upload
- Unsupported DropzoneEvents
- Support for Angular 10 HOT 2
- DropzoneHeadersFunction action not working
- TypeError: dropzone__WEBPACK_IMPORTED_MODULE_1__ is not a constructor HOT 17
- addedFile/addedFiles missing from DropzoneConfigInterface?
- Images sent directly from mobile get rotated by 90 degrees. HOT 1
- Problem with ssr self is not defined HOT 6
- OnAddedFile event not fired in version 10.0.1 HOT 1
- Generating browser application bundles (phase: setup)...Processing legacy "View Engine" libraries HOT 1
- Can't import the named export 'CommonModule' from non EcmaScript module (only default export is available) HOT 1
- Generic type 'eeDirectiveDeclaration' HOT 1
- How to overwrite the confirm function?
- Action Delete Image
- Directive has console.log since version 15.0.0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngx-dropzone-wrapper.