嘿伙计们,我对 Angular 还是很陌生。
用户可以在 profileSettings 页面中编辑配置文件设置。
我的个人资料模板上有以下内容:
<div>{{ user.name }}</div>
<a class="pull-right" ui-sref="profileSettings"><strong>Edit Name</strong></a>
...more code...
<div>{{ user.description }}</div>
<a class="pull-right" ui-sref="profileSettings"><strong>Edit Description</strong></a>
我希望他们能够单击将他们带到 Settingsprofile 模板的编辑链接。但是,我希望在新模板呈现时自动滚动到相关字段。
因此,如果他们单击名称的编辑链接,他们将被带到 profileSettings 模板并自动滚动到编辑名称字段。如果他们单击编辑描述链接,那么他们也会被重定向到 profileSettings 页面,但会自动滚动到编辑描述字段。
有没有一种简单的方法可以使用 Angular/ui-sref 做到这一点?