javascript - 保留点击 Angular ngFor的背景边框

标签 javascript css angular

我试图保留在我的面板的每一行上单击的蓝色背景边框,该面板显示每一行中每年的数据。目前我只能将鼠标悬停在一行上,而不管面板是否在多 View 中打开。

我试图改变这种设置蓝色边框的条件

 [class.active]="((i+'_'+yearData.year)) == selectedMonthIndex"

 [class.active]="((i+'_'+yearData.year)) == selectedMonthIndex{{i}}" but not working.

请找到插件链接 here

最佳答案

我已经更新了答案。你可以检查

Link to answer

您必须在模板中更改事件类的条件

<div class="col-md-1 month-hover" *ngFor="let monthData of yearData.cardData; let i = index" (click)="setClickedMonth((i+'_'+yearData.year),i1,monthData.view);" [class.active]="(((monthData.view)) == yearData.selected) && isActive[i1]">
  <ul class="col-md-12" style="list-style-type: none;line-height: 25px;">
     <li class="category-title ">
        {{monthData.view}}
      </li>
      <li class="category-value ">
         {{monthData.count}}
       </li>
     </ul>
  </div>

关于javascript - 保留点击 Angular ngFor的背景边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46947256/

相关文章:

javascript - 全局忽略某些字符

javascript - 如何检测当前页面是否是 AMP?

javascript - $window.location.href 不工作

javascript - 如何使用 set Attribute 方法更改 jquery 中的 css?

css - 如何缩小图像和文本之间的差距?

arrays - 如何使用 Angular 获取所有扑克牌图像并将其添加到数组中?

javascript - 如何使用 JavaScript 向 Android 手机发送 Firebase 通知

html - 选择单选按钮时更改单选按钮标签颜色?

angular - ngFor block 内模板中的异步管道触发 http GET 调用循环

Angular 迁移(从 4 到 6)e2e --proxy-config 不工作