简体   繁体   中英

ionic angular styling based on json

İ m trying to change the item color. Css is not working or im missing something else?

<ion-view title="Add order to a table">
    <ion-content class="has-header has-subheader">
        <ion-list>
            <ion-item ng-repeat="table in tables" type="item-text-wrap" class="item-avatar"
                      href="#/app/tables/{{table.id}}">
                <div ng-class="{table.Status === '0': 'red'}">
                {{table.Tablename}} - {{table.Status}}
                    <p ng-class="radio-high">dfsa</p>
                </div>
            </ion-item>
        </ion-list>
    </ion-content>
</ion-view>

ng-class="{ 'red' : table.status === 0 }"

Please try and share your observations

You have to do it like this as in Stackhelpers answer but the table.Status has to be capitalised or it will not work:

<ion-view title="Add order to a table">
  <ion-content class="has-header has-subheader">
    <ion-list>
      <ion-item ng-repeat="table in tables" type="item-text-wrap" class="item-avatar" href="#/app/tables/{{table.id}}">
        <div ng-class="{ 'red' : table.Status === 0 }">
          {{table.Tablename}} - {{table.Status}}
          <p ng-class="radio-high">dfsa</p>
        </div>
      </ion-item>
    </ion-list>
  </ion-content>
</ion-view>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM