【发布时间】:2019-04-20 21:34:33
【问题描述】:
使用 ion-navbar 和 Firebase 数据库。
我希望看到的是,根据 Firebase DB 中的“颜色”子项,将显示不同的 ion-navbar 背景颜色。
我目前正在使用 *ngIf 来解决我的问题,但我无法让它发挥作用。无论 this.selectedItem.color 的颜色如何,它都会一直显示蓝色背景(#85dec8,最后一个 *ngIf 语句)。
我的代码:
<ion-navbar class="bar">
<ion-title class="bar">{{selectedItem.name}}</ion-title>
<style *ngIf="selectedItem.color=='#ffce4e'">
.bar {
background-color: #ffce4e;
}
</style>
<style *ngIf="selectedItem.color=='#f55f7c'">
.bar {
background-color: #f55f7c;
}
</style>
<style *ngIf="selectedItem.color=='#85dec8'">
.bar {
background-color: #85dec8;
}
</style>
</ion-navbar>
任何帮助将不胜感激!
【问题讨论】:
标签: html css ionic-framework firebase-realtime-database