加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

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

发布时间:2020-12-17 17:53:11 所属栏目:安全 来源:网络整理
导读:我的app.js文件中有以下两条路由,由于某种原因我不知道何时尝试导航到/ clients / new-invoice我看到/ clients /:clientID路由和模板.我可以转到正确页面的唯一方法是删除/ clients /:clientID路由. 此外,我注意到只有在我将:clientID添加到下面的路由后
我的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.订单很重要.应在静态路径之后定义所有正则表达式路径.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读