So I've got an Angular app that has pretty basic routing, and I'm using flexbox to layout my components. The issue I can't figure out is with code like this:
<div fxLayout="column"
fxFlex
class="layout__right">
<router-outlet></router-outlet>
</div>
The child component that is routed to contains the following in its SCSS:
:host {
@include make-flex-container(column);
flex: 1;
}
That make-flex-container
just applies some flexbox related styles, and works fine in many places of the app. What's happening in my case though is when routing to this particular child component I see a style
tag applied to the ng-component
element created by Angular. What's causing my problem is for some reason the style includes flexbox items that are overriding what I'm putting in :host
:
You can see in the screenshot that my :host
styles are being applied, but the styles on the ng-component
tag are simply overriding them. For the life of me I can't understand why there's a specific style
tag added here, so where the content within it would come from. Does anyone know why Angular would put style tags on the HTML generated for router-outlets? When I navigate to other components at this same routing level this style tag isn't present.
I assume this is an issue with my code, but I just can't run down where to look given what I see.
UPDATE
Here's a minimal reproduction of the issue on Stackblitz:
https://so-48451609-routing-flex-issue.stackblitz.io
In that example you can see how the element created next to the router outlet has styles applied to it. The only dependency added there is @angular/flex-layout
, so it's gotta be doing something to cause this.