我正在使用node,express和angular js创建单页面应用程序。我没有得到如何管理角度和快递(节点)的路线。 请帮助我,如果可能的话给出一些示例代码或链接。
答案 0 :(得分:0)
如果您想创建单页面应用程序,则需要使用angular的路由器在应用程序中导航而无需重新加载,但通常需要来自服务器的数据,要组织此数据,您需要在节点上进行路由。
这是ngRoute的一个例子
http://plnkr.co/edit/L4Hxf7KiiVuouPWRv4pl
var app = angular.module("myApp", ["ngRoute"]);
app.config(function($routeProvider) {
$routeProvider
.when("/", {
template: 'hello'
})
.when("/red", {
template: 'hi'
})
.when("/green", {
templateUrl: 'hello.html'
})
.when("/blue", {
templateUrl: 'blue.html'
});
});