Possible to bind to ion-grid directives?


#1

I’d like to do something like this:

<ion-col col-3 [push-3]="shouldPush">

but I get an unknown-directive error. Is this not possible, do I need to import something, or is my syntax wrong?


#2

It is an attribute, try something like that:

<ion-col col-3 [attr.push-3]="shouldPush ? '' : null">

#3

works great, thank you!
I actually tried something very similar:

<ion-col col-3 [attr.push-3]="shouldPush">

but when binding to a boolean it was resulting in
<ion-col push-3="false">
which triggers push-3 behavior on all columns

I’ll have to remember that binding to null causes an attribute to disappear entirely and binding it to an empty string just adds the directive with no associated value.