我有一个路由配置,其中index是主页面,索引里面有一个
<div data-ui-view></div>
app.config(function ($stateProvider, $urlRouterProvider) {
'use strict';
$urlRouterProvider.otherwise("/");
$stateProvider
.state('/', {
url: '/',
templateUrl: "events.html"
})
.state('addactivities', {
url: '/addactivities',
templateUrl: "addactivity.html"
})
.state('managechat', {
url: '/managechat',
templateUrl: "chatmanagement.html"
})
.state('manageevent', {
url: '/manageevent:id',
templateUrl: "eventmanagement.html"
})
.state('manageactivity', {
url: '/manageactivity',
templateUrl: "activitymanagement.html"
})
.state('manageactivity.update', {
url: '/update/:id',
templateUrl: "updateactivity.html"
})
.state('login', {
url: '/login',
templateUrl: "login.html"
});
});
现在,索引加载,但视图没有加载,我得到这样的错误
angular.min.js:11630 GET http://localhost:3000/events.html 404 (Not Found)
var express = require("express");
var app = express();
var path = require("path");
app.use("/php",express.static(__dirname + '/php'));
app.use("/css",express.static(__dirname + '/css'));
app.use("/fonts",express.static(__dirname + '/fonts'));
app.use("/js",express.static(__dirname + '/js'));
app.get('/',function(req,res){
res.sendFile(path.join(__dirname+'/index.html'));
});
加载视图的正确方法是什么?因为加载它像index.html不起作用
app.get('/login',function(req,res){
res.sendFile(path.join(__dirname+'/login.html'));
});