【问题标题】:ionic angular styling based on json基于json的离子角度造型
【发布时间】:2016-08-26 17:28:06
【问题描述】:

我试图更改项目颜色。 Css 不工作或者我错过了什么?

<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>

【问题讨论】:

    标签: css angularjs json cordova ionic-framework


    【解决方案1】:

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

    请尝试分享您的观察结果

    【讨论】:

    • 效果很好。谢谢
    【解决方案2】:

    您必须像 Stackhelpers 回答中那样这样做,但 table.Status 必须大写,否则它将不起作用:

    <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>
    

    【讨论】:

    • 已解决;
      {{table.Tablename}} - {{table.Status}}
      喜欢;在 CSS 样式中定义
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-08
    • 2020-07-13
    • 2021-08-26
    • 1970-01-01
    相关资源
    最近更新 更多