flex-layout adding styles to parent element

Created on 15 Jul 2018  Â·  2Comments  Â·  Source: angular/flex-layout

Bug Report

What is the expected behavior?

Expected behaviour is that when adding fxFlex et al that style attributes are only applied on those elements where flex has been applied. For example:

<div [formGroup]="form”>
  <div fxFlex fxLayout="row" fxLayout.xs="column”>
    <div fxFlex="25" fxLayoutAlign="center center" class="logo-wrapper”>
    …
    </div>
  </div>
</div>

What is the current behavior?

The current behaviour is that flex attributes are getting injected into the parent elements, please see below:

Component Template

<h2>Assessment Center Settings</h2>
<div>
  <div fxFlex fxLayout="row" fxLayout.xs="column">
    XXXX
  </div>
</div>

Rendered HTML

<h2 _ngcontent-c19="">Assessment Center Settings</h2>
<div _ngcontent-c19="" style="flex-direction: row; box-sizing: border-box; display: flex;”> <--- why is this getting added??
  <div _ngcontent-c19="" fxflex="" fxlayout="row" fxlayout.xs="column" ng-reflect-layout="row" ng-reflect-layout-xs="column" ng-reflect-flex="" style="flex-direction: row; box-sizing: border-box; display: flex; flex: 1 1 0%;"> XXXX </div>
</div>

What are the steps to reproduce?

Providing a StackBlitz (or similar) is the best way to get the team to see your issue.

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular v6.0.3
@angular/flex-layout: "^6.0.0-beta.16"
Typescript 2.7.2
OS: macOS
Browsers: Chrome and Safari

Is there anything else we should know?

Most helpful comment

The current behavior _is_ the expected behavior, but can be overridden using the static config initializer:

FlexLayoutModule.withConfig({addFlexToParent: false})

All 2 comments

The current behavior _is_ the expected behavior, but can be overridden using the static config initializer:

FlexLayoutModule.withConfig({addFlexToParent: false})

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MarcusMorba picture MarcusMorba  Â·  3Comments

spottedmahn picture spottedmahn  Â·  5Comments

jcoronel94 picture jcoronel94  Â·  4Comments

mhosman picture mhosman  Â·  3Comments

mackelito picture mackelito  Â·  3Comments