[英]How to change glyphicon icon class on click event?
I have list of submenu at the sidebar with an glyphicon icon. 我在边栏上有一个带有glyphicon图标的子菜单列表。 My one li is clicked the icon should be changed.
我的一位李单击图标应更改。 At the moment when I click on one li all the icon are being changed.
目前,当我单击一个li时,所有图标都已更改。
This is the code I am working on. 这是我正在处理的代码。 I am not sure how to fix this issue.
我不确定如何解决此问题。
<ul class="nav third-nav">
<li appExpandMenu (click)="changeIcon()">
<a>
<span class="glyphicon glyphicon-menu-{{sign}} arrow"></span>
<span class="third-menu-title">Sales</span>
</a>
</li>
<li>...</li>
</ul>
<ul class="nav third-nav">
<li appExpandMenu (click)="changeIcon()">
<a>
<span class="glyphicon glyphicon-menu-{{sign}} arrow"></span>
<span class="third-menu-title">Report</span>
</a>
</li>
<li>...</li>
</ul>
export class SidebarComponent implements OnInit {
sign = 'up';
changeIcon(): void {
if (this.sign == 'up') {
this.sign = 'right';
} else {
this.sign = 'up';
}
}
}
如果您对代码有任何疑问,请在此处给出您需要的工作示例 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.