this Plunker에서 제대로 작동하려면 메뉴 링크와 탭을 만들 수 없습니다. 내가 볼 수 있듯이 'Route 1'을 두 번 클릭하여 Route2 탭으로 돌아가야합니다. 또한 'Route 2'메뉴 링크를 두 번 클릭하면 탭 콘텐츠가 렌더링되지 않습니다.UI-Bootstrap 탭과 UI-Router가있는 Angularjs 탐색 메뉴
나는이 중요한 코드의 관련 부분이라고 생각 :
myapp.config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise("/");
$stateProvider
.state('route1', {
url: "/",
templateUrl: "route1.html"
})
.state('DocumentoMasterView', {
url: "/route2",
templateUrl: "route2.html",
controller: 'myAppController'
})
.state('DocumentoMasterView.A', {
url: '/detail',
templateUrl: 'route2.A.view.html',
controller: 'myAppController'
})
.state('DocumentoMasterView.B', {
url: '/image',
templateUrl: 'route2.B.view.html',
controller: 'myAppController'
})
.state('DocumentoMasterView.C', {
url: '/submenu',
templateUrl: 'route2.C.view.html',
controller: 'myAppController'
})
});
myapp.controller('myAppController',['$scope','$state',function($scope, $state){
$scope.tabs = [
{ heading: 'A View', route:'DocumentoMasterView.A', active:true},
{ heading: 'B View', route:'DocumentoMasterView.B', active:false },
{ heading: 'C View', route:'DocumentoMasterView.C', active:false }
];
$scope.go = function(route){
$state.go(route);
};
$scope.active = function(route){
return $state.is(route);
};
$scope.$on('$stateChangeSuccess', function() {
$scope.tabs.forEach(function(tab) {
tab.active = $scope.active(tab.route);
});
});
, 마지막으로 한 가지 : 당신은 "2 호선"두 번 클릭하면 탭의 내용이 사라가 같을 것이다 NAV 특정 들어
. – Cris69
route2가 선택되면 항상 첫 번째 탭으로 이동하는 또 다른 기능인 "redirection"* (내 첫 번째 플 런커 업데이트) *를 소개합니다. $ urlRouterProvider.when ("/ route2", "/ route2/detail");'희망하시오.)'ui-router'를 즐기십시오 –
이 솔루션은 같은 탭을 두 번 클릭하여 다음 탭으로 전환하는 것과 같은 몇 가지 문제가 여전히 있으며 탭이 제대로 렌더링되지 않습니다. 나는 더 나은 해결책을 찾았다. (http://stackoverflow.com/questions/25017382/tabs-in-angularjs-not-working-properly-with-ui-router-and-u-bootstrap). – Cris69