我正在开发一个示例应用程序来学习 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">
工作正常。但是,当我尝试在新标签中打开链接时,它不会打开。
我知道路由是在客户端完成的,服务器也不知道它。
任何建议都会有所帮助。
我无法通过在线搜索找到任何相关的答案。
感谢。
EDIT :: 服务器端代码。
在nginx中:
location / {
root /home/myNgApp/;
autoindex on;
autoindex_exact_size off;
try_files $uri $uri/ /main.html;
}
答案 0 :(得分:0)