在AngularJS深层链接的多层次 [英] Multiple Layers of Deep Linking in AngularJS

查看:122
本文介绍了在AngularJS深层链接的多层次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图放置多个控制器我的模板的partials内与AngularJS-我遇到的问题是,在第一层的,直接联到这些子控制器及其相关片段。

I am attempting to place multiple controllers within my template partials with AngularJS- The problem I am encountering is that of the first layer, direct-linking to these sub-controllers and their related snippets.

一个例子是用户帐户的管理页面,说我是一个用户列表,并想改变从列表中的密码的用户,我点击了更改密码按钮,并希望将用户重定向到< ?code>#/ ManageUsers /的ChangePassword /用户名=&LT;这里UID&GT; ,而不是#/ ManageUsers_ChangePassword / 或相似,但关于这个问题的角度文档(或缺乏)表明,这是不可能的,或者不是'角路...

An example would be a management page for user accounts, say I am on a user-list and wanted to change a user from the list's password, I click on their change-password button, and want to redirect the user to #/ManageUsers/ChangePassword/?UserID=<uid here> rather than #/ManageUsers_ChangePassword/ or similar, but the Angular documentation (Or lack thereof) on the subject suggests that this is impossible, or not 'The Angular Way'...

作为我的团队希望把这些单独的控制器为谐音,是有一个非哈克的方式与角度做到这一点?

Being that my team wants to keep these separate controllers as partials, is there a non-hacky way to do this with Angular?

推荐答案

为什么不直接到#/ ManageUsers /的ChangePassword /:用户ID ?您可以从$ routeParams的用户名。请参阅 $航线页面上的一个例子。

why not direct to #/ManageUsers/ChangePassword/:UserID ? You can get the UserID from $routeParams. See an example on the $route page.

您甚至可以创建像#/ ManageUsers /路线:OrganizationID /:扇区/:用户ID /的ChangePassword /确认将由URL中使用#/ ManageUsers / 10/2/32 /的ChangePassword /确认

You can even create routes like #/ManageUsers/:OrganizationID/:SectorId/:UserID/ChangePassword/Confirmation that will be used by the url #/ManageUsers/10/2/32/ChangePassword/Confirmation

这篇关于在AngularJS深层链接的多层次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆