`

angular js 路由加express 路由

 
阅读更多
app.use(express.static(path.join(__dirname, 'public')));
app.use(app.router);
//some code
app.get('/',function(req,res)..............
app.get('/api',function(req,res)..............

//最后再重定向到首页
app.all('/*',function(req,res){
      res.render('index')
}
同样在angular中也要设定html5模式:

app.config(function($locationProvider){
    $locationProvider.html5Mode(true);
        //$locationProvider.hashPrefix('!');这个我觉得没必要添加,#!
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics