2017-01-10 3 views
0

내 웹 사이트의 AngularJS 경로로 작업하고 있지만 NG-VIEW는 아무 것도로드하지 않습니다. 나는 단지 "약"링크를 테스트하고있다. 탐색 바에서 "About me"를 클릭하면 NG-VIEW에 about.html이 표시됩니다. 여기AngularJS ng-view not load

index.html입니다 :

<!DOCTYPE html> 
<html lang="en-US"> 
    <head> 
     <link href="/css/style.css" rel="stylesheet"> 

    <link href='https://fonts.googleapis.com/css?family=Lato' rel='stylesheet' type='text/css'> 

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> 

    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular.min.js"></script> 

    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular-route.min.js"></script> 

    <script src="/js/parallax.js-1.4.2/parallax.js"></script> 

    <title>##</title> 
</head> 

<body ng-app="AgendaApp"> 

    <div class="header"> 
     <div class="container"> 
      <ul id="topnav"> 
       <li><a href="/">Home</a></li> 
       <li><a href="#/about">About Me</a></li> 
       <li><a href="#">GitHub</a></li> 
       <li><a href="#">Resume</a></li> 
       <li><a href="#">Facebook</a></li> 
      </ul> 
     </div> 
    </div> 

    <div class="main"> 
     <div class="container"> 
      <div ng-view></div> 
     </div> 
    </div> 



</body> 

<script src="js/app.js"></script> 
<script src="js/controllers/AgendaController.js"></script> 
<script src="js/controllers/ScheduleController.js"></script> 
<script src="js/services/schedules.js"></script> 

app.js입니다 :

var app= angular.module("AgendaApp", ['ngRoute']); 

app.config(function($routeProvider) { 
    $routeProvider 
    .when('/', { 
     controller: 'MainController', 
     templateUrl: 'views/main.html' 
    }) 
    .when('/about', { 
     controller: 'AgendaController', 
     templateUrl: 'views/about.html' 
    }) 
    .when('/detail', { 
     controller: 'ScheduleController', 
     templateUrl: 'views/schedule.html' 
    }) 
    .otherwise({ 
     redirectTo: '/' 
    }); 
}); 

및 컨트롤러 :

app.controller("AgendaController", ['$scope', 'schedules', function($scope, schedules) { 
    schedules.success(function(data){ 
     $scope.schedules = data; 
    }); 
}]); 

내 controlle r은 아직 아무 것도하지 않습니다.

답변

0

이 시도

<div class="container"> 
    <div class="row"> 
    <div class="col-sm-12"> 
     <div class="nav"> 
     <a href="#home" class="button">Home</a> 
     <a href="#about" class="button">About</a> 
     <a href="#detail" class="button">Detail</a> 
     </div> 
    </div> 
    </div> 
</div> 

<div class="container"> 
    <div ng-view=""></div> 
</div> 

DEMO

+0

정말 고마워요! 이제는 훌륭하게 작동합니다. –