One of the challenges I faced involved a div
element with a conditional *ngIf
statement and responsive layout values set using
fxFlex.lg="30" fxFlex.xl="50"
:
<div class="project-test__element" *ngIf="myCondition()" fxFlex.lg="30" fxFlex.xl="50" fxLayoutAlign="end center">
Test fxFlex.lg and fxFlex.xl
</div>
The styling applied to this particular div
included:
place-content: center flex-end;
align-items: center;
flex-direction: row;
box-sizing: border-box;
display: flex;
flex: 1 1 100%;
max-width: 30%; (30% for lg and 50% for xl)
However, transitioning from HD to Full HD resolution caused the removal of the max-width
property. The solution involved separating the *ngIf
logic into a new outer div
preceding the inner div
containing the fxFlex
directives.
So, the question arises: Why do *ngIf
and fxFlex
clash when used together? Discover more about them through @angular/flex-layout.
Current versions in use include:
Angular: 8.1.3
@angular/flex-layout: 8.0.0-beta.26