date-time-picker icon indicating copy to clipboard operation
date-time-picker copied to clipboard

CSS style not imported in web component

Open bmickoski opened this issue 4 years ago • 2 comments

When using ViewEncapsulation.ShadowDom external lib css is not being imported in custom element component. Dynamic Form Component is defined as Custom Element which uses custom lib that imports date-time-picker.

 /**
     * Application bootstrap
     */
    ngDoBootstrap(): void {
        const dynamicFormElement = createCustomElement(DynamicFormComponent, {
            injector: this.injector,
        });

        // Update module configuration. Add shadow root object.
        customElements.define(WEB_CMP_SELECTOR, dynamicFormElement);
        const el = this.document.querySelector(WEB_CMP_SELECTOR);
        if (el && el.shadowRoot) {
            config.SHADOW_ROOT = el.shadowRoot;
        }
    }

Dynamic Component css file

// this import is not working
@import "~@danielmoncada/angular-datetime-picker/assets/style/picker.min.css";

:host {
    font-family: "Raleway"....
}


And from the image below we can see that style is added in shadowRoot but it is still messed up.

image

bmickoski avatar Oct 27 '21 10:10 bmickoski

May i know, Why this issue got closed without any reply. i am looking for solution of this problem

ankurrai2602 avatar Apr 19 '22 14:04 ankurrai2602

May i know, Why this issue got closed without any reply. i am looking for solution of this problem

Never heard back from OP.

I'll re-open, thanks for replying.

danielmoncada avatar Apr 30 '22 19:04 danielmoncada