-
Notifications
You must be signed in to change notification settings - Fork 393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Won't fix] Investigate styling components rendered using cxComponentWrapper #2084
Comments
Louis says: I would like to have some time to investigate before beta. Wouldn’t be very long to try it out maybe half day |
After looking into this issue I was able to identify the cause of it and find a few ways around it. The issue is caused by the Angular default view encapsulation : There are different workarounds for this issue: If possible most style should be applied to the child component (the one rendered by the In the case where the styling has to be on the parent e.g. alignment four are three ways around this issue:
|
A fix for this can be seen in angular/angular#12215, view related PRs. TLDR: manually add the parent _ngContent-c# in the child component. View jss project PR 191. |
After working a bit on the solution, I was able to make it work in the Angular default view encapsulation with some fancy tricks. The tricks are perhaps a bit too fancy so after discussion with Tobias we wont go with this solution. An alternative way to the three that were stated in an earlier comment is to set the default view encapsulation to none throughout the app. This can be achieved by adding this to the
which makes the configuration look like this:
|
Following a discussion on the Spartacus Slack, it was noted that styling components dynamically rendered using
cxComponentWrapper
was causing issues.Steps to Reproduce
in
test-parent.component.html
In the code example above
cxComponentWrapper
renders an element of typetest-child
.Within
test-parent.component.scss
, these elements should be styleable using:Observed Results
The styling is not applied to the
test-child
componentExpected Results
The styling should be applied
Possible reason
This could be caused by the way Angular builds the components and applies the styles in their emulated view encapsulation.
For more info https://spartacus-storefront.slack.com/archives/CD16V16FR/p1555588176034300
The text was updated successfully, but these errors were encountered: