【发布时间】:2020-06-22 14:56:21
【问题描述】:
我正在使用 angularjs,并且我有一个非常基本的应用程序...
let app = angular.module('GHoF', [
'ngRoute'
]);
app.config(function Config($routeProvider) {
// Routes
console.log($routeProvider);
$routeProvider
.when('/applications', {
templateUrl: 'app/pages/myApplications/myApplications.html',
controller: 'MyApplicationsCtrl'
})
.otherwise({
redirectTo: 'app/pages/auth.html'
})
});
HTML
<html lang="en" ng-app="GHoF">
<head>
<script src="node_modules/angular/angular.js"></script>
<script src="node_modules/angular-route/angular-route.js"></script>
<script src="app/app.js"></script>
<title>Home</title>
</head>
<body>
<main ng-view></main>
</body>
问题在于它将我重定向到错误的 URL。
我不知道为什么,但它在 URL 中显示为 /#!。这是一个非常基本的应用程序...
【问题讨论】:
-
因为您已将其设置为使用 hashbang
-
什么意思?除了我所拥有的,我没有配置任何其他东西
-
它工作...谢谢..
标签: javascript angularjs ngroute