我有这样的代码和每一个我输入“本地主机:3000 /第1页”时什么也没发生,我得到拿不到/第1页,这是代码..我声明的状态没有被拾起?
var module = angular.module('ngFirstApp',['ui.router']);
module.config(function($stateProvider, $urlRouterProvider,$locationProvider) {
$stateProvider
.state("home",{ url: "/", template: "This is home" })
.state("page1",{ url: "/page1", template: "this is page"});
// Prety the URL
$locationProvider.html5Mode({enabled:true,requireBase: false});
$urlRouterProvider.otherwise("/"); // always declare this for any URL that might be typed
});
请即时通讯失去了我的脑海里,怎么来的时我把一个乱码网址它不需要我回到“/”状态?怎么了!??即时通讯这个洙沮丧..小时,寻找答案..小时
UPDATE: 我的继承人server.js代码,以及它是否会有所帮助,如果youre想知道如果我添加了UI的路由器,我做在我的HTML和双重检查开发工具网络选项卡没有错误..感到非常沮丧。
var express = require('express');
var app = express();
var path = require('path'); // native js node path
// set routing to ejs and change its default view folder
app.set('view engine','ejs');
app.set('views',path.resolve(__dirname,'client','views'));
// serve static files
app.use(express.static(__dirname + '/client'));
// set our main ejs view index file
app.get('/',function(req, res){
res.render('views/index');// use the render to use ejs templating
})
// make app listen to port 3000 or any port
app.listen(3000, function(){
console.log('Server is running... at port: '+ 3000);
})
检查控制台日志中是否有错误 –
尝试localhost/page1是否工作。如果工作,那么你有CORS问题。 – digit
我检查控制台它只是一个正常的[HTTP/1.1 404 Not Found 7ms]错误...我剥离代码裸露,仍然不知道为什么它不拿起page1 url ... ughhaa .. @digi什么是CORS问题? – Chopnut