나는 다음과 같은 HTML 코드가 있습니다 section1
, section2
및 main_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: '/'
});
}]);
라우팅은 어떻게 생겼습니까? – cDima
@cDima, 라우팅 코드 – Amparo
을 추가했습니다. 콘솔에 오류가 있습니까? – underscore