'Dynamically change the Column size on ionic

I am trying to dynamically change the Column size

<ion-col [size]="this.size" [size-xl]="this.size_xl" [size-md]="this.size_md" [size-sm]="this.size_sm" [size-xs]="this.size_xs">

but this error appears

NG0303: Can’t bind to ‘size-xl’ since it isn’t a known property of ‘ion-col’.

NOTE

its just working on [size]=“this.size”



Solution 1:[1]

You can do something like:

<ion-col [size]="size" [attr.size-xl]="size_xl" [attr.size-md]="size_md" [attr.size-sm]="size_sm" [attr.size-xs]="size_xs">

Although there's probably no need to define all the sizes, you can probably just define a single place for logic that'll handle the default size attribute.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Misha Mashina