Skip to content

enable fuzzy matching for $state.is #1019

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

Closed
samccone opened this issue Apr 10, 2014 · 6 comments
Closed

enable fuzzy matching for $state.is #1019

samccone opened this issue Apr 10, 2014 · 6 comments

Comments

@samccone
Copy link
Contributor

For example it would be quite nice to be able to do

if (!$state.is("foo.*")) {
}

instead of

if (!$state.is("foo.tap") && !$state.is("foo.bar" )) {
}

I would be more than willing to PR this in, wanted to get your thoughts before I implemented.

@nateabele
Copy link
Contributor

$state.is() already has glob support, I believe.

@samccone
Copy link
Contributor Author

seems like maybe not

return $state.is(state);

also
#244

@timkindberg
Copy link
Contributor

@samccone
Copy link
Contributor Author

Includes vs is :)

@timkindberg
Copy link
Contributor

is to me means strict equality... so using globs alongside a concept of strict equality makes no sense, thats why we put that functionality into includes.

@alexey-sh
Copy link

alexey-sh commented Apr 17, 2017

doesn't work when:
state: base (abstract)
state: base.auth (abstract)
state: base.auth.login (common state)

$state.is('base.auth.*') => undefined
$state.is('base.auth') => false
$state.is('base') => false
$state.is('base.*') => undefined
$state.is('') => undefined

;(

> $state.current
<- {name: "", url: "^", views: null, abstract: true}

state is empty only during executing run angular function

#1627 (comment)

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

No branches or pull requests

4 participants