2015-01-03 3 views
0

나는 다음과 같은 HTML 코드가 있습니다 section1, section2main_section : 우리가 볼 수 있듯이변경 내용 whitout NG-보기

<html> 
<head> 
<!-- ... --> 
</head> 
<body> 
    <section id="section1" ng-include="'section1.html'"></section> 
    <section id="section2" ng-include="'section2.html'"></section> 
    <section id="main_section" ng-view></section> 
</body> 
</html> 

, 나는 3 개 섹션이 있습니다. main_section은 (분명히) 주요 섹션이며 ng_view 속성을 가지고 있으므로 사용자가 http://example.com/#!/main/any과 같은 URL을 입력하면 main_section에 주 콘텐츠가 표시됩니다. 이제 사용자가 http://example.com/#!/two/other과 같은 링크를 클릭 할 때 section1에 새로운 콘텐츠를 표시하고 싶지만 main_section 콘텐츠를 변경하지는 않겠습니다.

편집 :

app.config(['$routeProvider', function($routeProvider) { 
     $routeProvider. 
      when('/', { 
       templateUrl: 'module/foo.html', 
       controller: 'FooController', 
       controllerAs: 'foo' 
      }).when('/main/:bar_id', { 
       templateUrl: 'module/foo.html', 
       controller: 'FooController', 
       controllerAs: 'foo' 
      }).otherwise({ 
       redirectTo: '/' 
      }); 
    }]); 
+0

라우팅은 어떻게 생겼습니까? – cDima

+0

@cDima, 라우팅 코드 – Amparo

+0

을 추가했습니다. 콘솔에 오류가 있습니까? – underscore

답변

1

라우팅 문제 상자의 각 경로가 중첩 된 뷰를 지원하지 않는다는 것입니다; 두 가지 옵션이 있습니다. ngSwitch을 사용하거나 중첩 된 뷰와 계층 구조를 지원하는 ui-router의 상태 패러다임을 사용하십시오.

+0

고맙습니다.'''ngSwitch'''을 시도해 보겠습니다. – Amparo