Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uiSref should allow transition to state with empty url #1362

Closed
christopherthielen opened this issue Sep 12, 2014 · 4 comments
Closed

uiSref should allow transition to state with empty url #1362

christopherthielen opened this issue Sep 12, 2014 · 4 comments
Assignees
Labels
Milestone

Comments

@christopherthielen
Copy link
Contributor

see comments in #1319

@christopherthielen
Copy link
Contributor Author

@nateabele should we change this code to generate a "#" url (or "" in html5mode)?

https:/angular-ui/ui-router/blob/master/src/state.js#L1119

That way we'll return an empty string or hash and the ui-sref will be clickable (nav set to true).

https:/angular-ui/ui-router/blob/master/src/stateDirectives.js#L112

We'll still need the check for preventDefault, but only in html5mode, or actually when the generated href is "".

See PR #1363 ... it's only generating an HREF if the top state has the url: "" (as opposed to no url: at all, or url: undefined)

@christopherthielen
Copy link
Contributor Author

Here's the updated plunk from #1319

http://plnkr.co/edit/mkIORnnEU1udoTmoX7V0?p=preview

@nateabele
Copy link
Contributor

An empty string still wouldn't work because of https:/angular/angular.js/blob/master/src/ng/directive/a.js#L42 — all nav does is avoid burning extra cycles recalculating things.

Ah, just saw the PR. Looks good, but definitely needs test coverage.

@christopherthielen
Copy link
Contributor Author

Closed via #1363

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants