angularjs – AngualrJS routeProvider路由到错误的模板

前端之家收集整理的这篇文章主要介绍了angularjs – AngualrJS routeProvider路由到错误的模板前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我的app.js文件中有以下两条路由,由于某种原因我不知道何时尝试导航到/ clients / new-invoice我看到/ clients /:clientID路由和模板.我可以转到正确页面的唯一方法删除/ clients /:clientID路由.

此外,我注意到只有在我将:clientID添加到下面的路由后才开始发生这种情况.

有人可以通过告诉我我在这里做错了什么来帮助我吗?

$routeProvider.when('/clients/:clientID',{     templateUrl: 'templates/client-profile-view.html',controller: 'ClientsController',title: 'Client Profile',data: {
                     auth: true,plevel: [5] 
                  }                
            });    


    $routeProvider.when('/clients/new-invoice',{     templateUrl: 'templates/new-invoice.html',controller: 'InvoicesController',title: 'New Invoice',plevel: [5] 
                  }                
            });

解决方法

您只需更改订单,在/ clients / new-invoice之后放置/ clients /:clientID.订单很重要.应在静态路径之后定义所有正则表达式路径.

猜你在找的Angularjs相关文章