我正在开发一个示例应用程序来学习AngularJs。
有三个链接显示ng-view
.
main.html 有三个链接。
$routeProvider.when('/add/:num',{
templateUrl: 'addition.html',
controller: 'addCtrl',
requireLogin : true
})
.when('/multiply/:num/',{
templateUrl: 'multiplication.html',
controller: 'multiplyCtrl',
requireLogin : true
})
.when('/filter',{
templateUrl: 'filter.html',
controller: 'filterCtrl',
requireLogin : true
})
.when('/main',{
templateUrl: 'main.html',
requireLogin : false
});
这是锚点:
<a href="add/5">
它工作正常。但是当我尝试在新选项卡中打开链接时,它不会打开。
我知道路由是在客户端完成的,服务器不知道。
任何建议都会有所帮助。
我通过在线搜索找不到任何相关的答案。
谢谢。
编辑::服务器端代码。
在 nginx 中:
location / {
root /home/myNgApp/;
autoindex on;
autoindex_exact_size off;
try_files $uri $uri/ /main.html;
}