I am having a problem with ngStyle after updating to angular 7. In angular 5 its working fine.
Using ngStyle I am dynamically applying style with Css grid.
but dont know why 'grid-column': '1 / span 2' is not working.
here is my code
<div class="widthHeight100"
[ngStyle]="getStyleForGroup(group)">
<div *ngFor="let subGroup of group?.childs"
[ngStyle]="getStyleForSubGroup(subGroup)">
In typescript
Grid container:
getStyleForGroup(mdg: MdgSimple) {
let style: any = {
'width': '100%',
'height': '100%'
};
if (!isNullOrUndefined(mdg)) {
if (!isNullOrUndefined(mdg.childs)) {
if (mdg.childs.length > 0) {
style = {
'display': 'grid',
'grid-template-rows': this.getGridTemplateCount(mdg.childs, true),
'grid-template-columns': this.getGridTemplateCount(mdg.childs, false),
'grid-column-gap': '4px',
'grid-row-gap': '4px',
'justify-items': 'start',
'align-items': 'start',
'padding': '5px'
};
}
}
}
return style;
}
Childs:
getStyleForSubGroup(mdsg: MdsgSimple) {
let style: any = {
'width': '100%',
'height': '100%'
};
if (!isNullOrUndefined(mdsg) && !isNullOrUndefined(mdsg.layout)) {
style = {
'grid-row': this.getCssRowInfo(mdsg),
'grid-column': this.getCssColumnInfo(mdsg),
'height': this.getHeight(mdsg),
'width': this.getWidth(mdsg),
'min-width': this.getMinWidth(mdsg),
'max-width': this.getMaxWidth(mdsg),
'min-height': this.getMinHeight(mdsg),
'max-height': this.getMaxHeight(mdsg),
};
}
return style;
}
But controls are overlapping each other. I have checked using chrome css element inspector grid area showing unsafe.
But its all working fine in angular 5 version. example 1 / span 2 also not working
here is screen shot for error.
Any suggestion please ?