1
votes

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:

the directive will automatically generate & update the href attribute via the $state.href() method

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.

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?

1

1 Answers

0
votes

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

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.

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