router上使用href吗

router上使用href吗

本文介绍了Angular-UI-Router:我应该避免在ui-router上使用href吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

浏览对ui路由器的引用( https://github.com/angular-ui/ui-router/wiki/Quick-Reference#ui-sref )关于ui-sref的说法如下:

Looking through the reference to ui-router (https://github.com/angular-ui/ui-router/wiki/Quick-Reference#ui-sref) the following is said about ui-sref:

从所有方面考虑,这实际上使ui-sref可以完全替代href:不仅适用于状态,而且还可以处理url.

All things considered, this essentially makes ui-sref a full replacement to href: not only it works with states, but also takes care of url.

这是否意味着在有角度的ui-router应用程序中,即使对于全球范围,SPA范围的页面,最好也避免使用hrefs,而仅将ui-sref用于导航?

Does it mean that in an angular ui-router app it is best to avoid hrefs even for global, SPA-wide pages and use ui-sref exclusively for navigation?

推荐答案

实际上,hrefs在后期状态边界方面可能非常有用(由FutureStates实现 https://christopherthielen.github.io/ui-router-extras/#/future )

Actually, hrefs might be quite useful with late-stage state bounding (achieved with FutureStates https://christopherthielen.github.io/ui-router-extras/#/future)

虽然在渲染ui-sref时可能尚未加载嵌套状态本身,但是href始终可用,并且可以指向任何将来的状态.

While the nested state itself might not yet be loaded at the point of rendering ui-sref, href is always available and can point to any future state.

也许有一种方法可以为FutureState中的嵌套状态定义框架,但我没有意识到.

There might be a way to define a skeleton for nested states inside FutureState, but none that I aware of.

这篇关于Angular-UI-Router:我应该避免在ui-router上使用href吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 01:47