誰かが私に助けてくれますか?ホームコントローラーには対応していません。それは私がhttp://localhost/myangular/TemplateUrlにhome.htmlが表示されない
index.htmlを
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
</head>
<body>
<div ng-view></div>
<!-- Include the AngularJS library -->
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js"></script>
<!-- Include main.js -->
<script src="js/main.js"></script>
</body>
</html>
main.js
var app = angular.module("myApp", []);
app.config(function($routeProvider) {
$routeProvider
.when('/', {
templateUrl: "templates/home.html",
controller: 'HomeController'
})
.otherwise({
redirectTo: '/'
});
});
app.controller('HomeController', function($scope) {
});
home.html
<h1>hello home</h1>
動作しません続いてngRoute依存関係を使用していませんか? – jemz
ああ。私は今、ngRouteが分かれているのを見ています。ありがとうございます – jemz
私はちょうど私の答えを編集しました。 ngRouteは、AngularJS 1.2.0以降、独自のモジュールに分けられました。 –