【发布时间】:2023-03-27 04:19:02
【问题描述】:
我有 6 个 html 文件,其中使用 angular js 配置 ngroute,每个 html 文件都有图像 jquery 滑块,我使用 node express web 服务器作为服务器,如果我启动我的服务器,它在 3000 端口上运行我打开我的浏览器并加载 localhost:3000 我能够获取 index.html 文件及其内容如果我导航到其他菜单链接我无法获取该 html 文件的内容但它仅加载预加载器,我发布我的下面的 HTML 和 Angular js 代码请纠正我的任何错误
HTML
<div class="navbar-collapse pull-right nav-main-collapse collapse" ng-app="sam">
<nav class="nav-main">
<!--NOTE
For a regular link, remove "dropdown" class from LI tag and "dropdown-toggle" class from the href.
Direct Link Example:
<li> <a href="#">HOME</a> </li>
-->
<ul id="topMain" class="nav nav-pills nav-main">
<li class="active"><!-- HOME -->
<a href="#index"> Home </a> </li>
<li class="active"><!-- Instruction to Authors -->
<a href="#author"> Instructions to Authors </a> </li>
<li class="active"><!-- Manuscript Submission -->
<a href="#manuscript">Manuscript Submission </a> </li>
<li class="active"><!-- Contents -->
<a href="#contents"> Contents </a> </li>
<li class="active"><!-- Editorial Board -->
<a href="#editorial"> Editorial Policy </a> </li>
<li class="active"><!-- Contact Us -->
<a href="#contact"> Contact Us </a> </li>
</ul>
<div ng-view></div>
</nav>
</div>
script.js(角度 js 文件)
var app = angular.module('sam', ['ngRoute']);
app.config(function ($routeProvider) {
$routeProvider.
when('/index', {
templateUrl: 'index.html'
}).
when('/author', {
templateUrl: 'author.html'
}).
when('/contact', {
templateUrl: 'contact.html'
}).
when('/contents', {
templateUrl: 'contents.html'
}).
when('/editorial', {
templateUrl: 'editorial.html'
}).
when('/manuscript', {
templateUrl: 'manuscript.html'
});
});
【问题讨论】:
标签: html angularjs node.js ngroute angularjs-ng-route