나는 내 인생에서 내가 잘못하고있는 것을 파악할 수 없다. 몇 가지 기본 AngularJS 라우팅을 수행하는 John Linquist 비디오를 보러갑니다. partials
폴더에 내 index.html
페이지에 내 테이블이없고 (따라서 ng-view
을 사용하지 않아서 라우팅을 구성 할 필요가 없으므로 작동합니다.) 그러나 테이블의 일부분을Angular JS와의 라우팅 문제
는
angular.module('enterprise',[])
.config(function($routeProvider){
$routeProvider.when("/",{templateUrl:"/partials/list.html"})
})
//this is the that iterated over in the partial view's ng-repeat
function AppController($scope){
$scope.crew =[
{name:'Picard',description:'captain'},
{name: 'Riker',description:'number 1'},
{name:'Word',description:'Security'}
]
}
index.html을
<!DOCTYPE html>
<html>
<head>
<title>Angular JS Routing</title>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css"/>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css" rel="stylesheet">
</head>
<body>
<div ng-app="enterprise" ng-controller="AppController">
<a href="/"><h2>Enterprise Crew</h2></a>
<ng-view></ng-view>
//list.html should be injected here
</div>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular.min.js"></script>
<script src="js/app.js"></script>
</body>
</html>
list.html
을 app.js (각 문서에서) http://goo.gl/nZAgrj :<ng-view></ng-view>
다음 나는 오류
<table class="table table-striped" style="width: 250px">
<thead>
<tr>
<td>Name</td>
<td>Description</td>
<td><i class="glyphicon glyphicon-plus-sign"></i> </td>
</tr>
</thead>
<tbody>
<tr ng-repeat="person in crew">
<td>{{person.name}}</td>
<td>{{person.description}}</td>
<td><i class="glyphicon glyphicon-edit"></i></td>
</tr>
</tbody>
</table>
글쎄, 당신에게 선생님 감사합니다. 나는 내가 본 적이있는 모든 자습서에서 구체적으로 포함시키지 않았기 때문에 라우팅이 내장되어 있지 않은 각도의 버전을 발견했다. – wootscootinboogie
그들은 1.2 버전에 포함시키지 않습니다. 그것의 일반적인 문제. – Nix