1
私はangularJSを初めて使い、anglejsルーティング上のvisual studioのチュートリアルに取り組んでいますが、URLリンクを変更してもng-viewは変更されません。 これはこれは私が/index.html#/homeへのURLを変更するにもかかわらず、div要素の内容は「常に私のcontroller.jsVisual StudioでのAngularJSルーティングについて2015
var app = angular.module('mainApp', ['ngRoute']);
app.config(function($routeProvider) {
$routeProvider
.when('/home', {
template: 'Home'
})
.when('/anotherpage', {
template: 'another page'
})
.otherwise({
template: 'index'
});
});
である私のindex.html
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script src="controller.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-route.js"></script>
<meta charset="utf-8" />
</head>
<body ng-app="mainApp">
<a href="#/home">home</a>
<a href="#/anotherpage">another page</a>
<div ng-view></div>
</body>
</html>
ですインデックス '。誰もこれのための任意のソリューションを提案することができます。
正常に機能しました。ありがとうございました。 –