我有每周有多个不同时间段的角码。它们都在ng-repeat内。我希望能够在鼠标悬停在该项目上时更改时间段的颜色。用我现在的代码,颜色获得ng-repeat中每个项目的变化。更改ng-repeat中单个元素的样式
public onSegmentMouseOverLeave(changeSegmentColor : boolean) : void {
this.timeSegmentColor = changeSegmentColor;
}
.time-segment-grid {
position: absolute;
top: 0;
margin-top: 2px;
height: 35px;
border-radius: 5px;
cursor: pointer;
z-index: 1;
#gradient > .vertical(#1b9dd0, #0080b5);
}
.time-segment-grid-onmove {
position: absolute;
top: 0;
margin-top: 2px;
height: 35px;
border-radius: 5px;
cursor: pointer;
z-index: 1;
#gradient > .vertical(#f442d7, #0080b5);
}
<div>
<div ng-repeat="timeSegment in $ctrl.deal.deal_settings.dayparting.schedule[dayName] track by $index">
<span ng-class="$ctrl.daypartingTimeSegments.timeSegmentColor ? 'time-segment-grid' : 'time-segment-grid-onmove' "
ng-style="$ctrl.daypartingTimeSegments.timeSegmentGridStyle(timeSegment)"
ng-mousedown="$ctrl.daypartingTimeSegments.onSegmentDragStart($event, dayName, $index, 'dragFullContent')"
ng-mouseover="$ctrl.daypartingTimeSegments.onSegmentMouseOverLeave(false)"
ng-mouseleave="$ctrl.daypartingTimeSegments.onSegmentMouseOverLeave(true)">
</span>
</div>
</div>
大这个工作谢谢! – BrianM