Better understanding for I mentioned the Images.
If i am not selecting anything of div Property, the default style(css) should be Like this , alteast selected one div. but here, problem is unable to selected.
this is my component :
<div *ngFor="let item of data; let i = index;" (click)="setRow(i)"
[ngClass]="{'highlight': selectedIndex===i}" class="cycleHover"
>
{{item}}
</div>
css :
.cycleHover{
cursor: pointer;
padding: 5px 20px;
margin: 4px;
font-style: normal;
font-weight: 700;
font-size: 14px;
// line-height: 18px;
color: #010103;
}
.highlight{
background-color: #fff;
padding: 5px 20px;
margin: 4px;
color: #737D88;
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.05);
border-radius: 24px;
}
ts:
selectedIndex: any;
data: any[] = ["D", "W", "M", "Q", "Y"];
setRow(_index: number) {
this.selectedIndex = _index;
}