0

I am using the ionic 3 and i have created grids.

<ion-row>
<ion-col col-4 offset-4>

</ion-col>
</ion-row>

And Now i want to apply conditions on columns offset for this i have applied this code given below, but i got the error.

<ion-row>
<ion-col col-4 offset-{{(variable == 1)?'4':'0'}}>

</ion-col>
</ion-row>

If anyone has suggestions so plz help me Thanks

4

1 回答 1

0

你不能将值绑定到偏移量,我认为你应该试试这个,首先在你的 ts 文件中创建一个变量,offsetVariable = true 然后在你的 HTML 文件中

<ion-row>
  <ion-col col-4 offset-4 *ngIf="offsetVariable">

  </ion-col>
</ion-row>

<ion-row>
    <ion-col col-4 offset-0 *ngIf="!offsetVariable">
    
    </ion-col>
</ion-row>
于 2020-07-18T21:31:41.443 回答