경로를 가져 오는 링크의 색을 변경하려고 시도했지만 작동하지 않지만 원하는 방식이 아닙니다.Angular.js 활성 탐색 요소
내가 http://localhost:8000/projects.html
바로 벌금이다 :
무엇인지 지금 일어나고있는 것은 이것이다?
집에가는 것처럼 다음 링크를 클릭하면 : 내가 말하는 것을 이해 http://localhost:8000/index.html
대신 http://localhost:8000/projects.html#/index.html
:
http://localhost:8000/projects.html#/index.html
내가이 링크로 이동하려면? 이 문제를 어떻게 해결할 수 있습니까? 고맙습니다.
는
App.controller('NavCtrl', ['$scope', '$location', function($scope, $location) {
$scope.items = [
{path: '/index.html', title: 'Home'},
{path: '/projects.html', title: 'Projects'},
{path: '/contributions.html', title: 'Contributions'},
];
$scope.isActive = function(item) {
if (item.path == $location.path()) {
return true;
}
return false;
};
}])
.controller('MyCtrl1', [function() {
}])
.controller('MyCtrl2', [function() {
}]);
HTML을 app.js :
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav" ng-controller="NavCtrl">
<li ng-repeat="item in items" ng-class="{active: isActive(item)}">
<a href="#{{item.path}}">{{item.title}}</a>
</li>
</ul>
</div>
응용 프로그램 내에서 페이지 수준 탐색 기능을 제공하려는 경우 ngRoute 및 ui-router가 작동하는 방식을 살펴볼 수 있습니다. – mindparse