2017-03-26 5 views
0

Facebookのような通知ドロップダウンをしようとしていますが、通知が未読のときは未読の状態が真または偽であるため、この通知の背景色を灰色にしたいそうでなければ未読は未読= falseなので、バックグラウンドは白です。私はそれを読んで未読の通知を作るためにクリックするとバブルがあります!Facebook通知のドロップダウンby角度

<li ng-if="vm.logged"> 
      <div class="dropdown"> 
      <button class="btn-noti" id="dropdownNoti" ng-click="vm.showDropdown($event)"> 
       <span class="fa fa-bell-o"></span> 
      </button> 
      <ul class="dropdown-menu" aria-labelledby="dropdownNoti"> 
       <div class="col-md-12 col-xs-12" style="border-bottom: #655771;border-bottom-style: double;"> 
       <h5 class="notification-title"><i class="fa fa-bell"></i> Notifications</h5> 
       <a class="mark-all" ng-click="vm.markAllRead()">Mark all as read</a> 
       </div> 
       <li ng-if="!vm.notifications.length"><a>You have no new notification yet.</a></li> 
       <li class="notification-type" ng-repeat="notification in vm.notifications" ng-if="notification.unread==true" ng-style="{'color':'red'}" style="border-bottom-style: ridge;"> 
       <a href="">{{notification.description}} 
        <h6><i class="fa fa-clock-o"></i> {{vm.timeOf(notification)}}</h6> 
       </a> 
       <a class="mark-as btn btn-default " ng-click="vm.markAsRead(notification.id)"></a> 
       </li> 
      </ul> 
      </div> 
     </li> 

答えて

0

あなたが式をテストし、私はそのNGスタイルを使用

ng-class="$variableToEvaluate ? 'class-if-true' : 'class-if-false'"> 
+1

background-color propety = "{『背景色』で特定のクラスを追加するためにng-classを使用する必要があります。notification.unread == falseを? '白': '#f5f5f5'} "それは働いた^^ –

関連する問題