【发布时间】:2019-07-28 07:16:06
【问题描述】:
我正在使用以下代码:
<li class="sidebar-list-item"><a ng-class="getClass('/dashboardHome')" href="/dashboardHome" class="sidebar-link text-muted"><i class="o-home-1 mr-3 text-gray"></i><span>Home</span></a></li>
$scope.getClass = function (path) {
console.log("Path: "+path);
return ($location.path().substr(0, path.length) === path) ? 'active' : '';
}
在控制台上我得到:路径:/dashboardHome
但不是它不起作用。
【问题讨论】:
标签: jquery angularjs bootstrap-4