【发布时间】:2017-01-13 01:02:41
【问题描述】:
首先让我对格式设置表示歉意。我用手机发帖。
在我的 /public/js/app.js 我有这个
var app = angular.module("myApp", ["ngRoute"]);
app.config(function($routeProvider) {
$routeProvider
.when("/", {
templateUrl : "/public/views/index.html"
})
.when("/packages", {
templateUrl : "/public/views/packages.html"
})
.when("/contactus", {
templateUrl : "/public/views/contactus.html"
})
.when("/signup", {
templateUrl : "/public/views/signup.html"
})
. otherwise({
redirectTo: "/";
});
});
在我的 /public/index.html
下面有这个
<html ng-App="myApp">
// All the angular script files including app.js
<body>
<div ng-view></div>
我所有的 HTML 文件都位于 /public/views/
我得到“无法 GET '/contactus'”
或者任何不是索引的网页。
有什么帮助吗?
【问题讨论】:
-
在您的浏览器中,您要访问 URL '/contactus' 还是 URL '/#/contactus'?您可能需要使用后者。
-
我要在浏览器中访问 /contactus