1

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 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.