Rutwick Gangurde
Rutwick Gangurde

Reputation: 4912

Angular UI router - Check parent state?

TLDR; Is there a function similar to state.is() to check for a state which has a lot of child states, from one of its child states?

This is my setup:

Parent 1
    Child 1.1
    Child 1.2
    Child 1.3

Parent 2
    Child 2.1
        Child 2.1.1
        Child 2.1.2
    Child 2.2
    Child 2.3

I want to hide a certain element on all the children and grandchildren of Parent 2. Currently I am using the ugly way of checking each and every state.

Upvotes: 1

Views: 971

Answers (1)

liamness
liamness

Reputation: 742

Use $state.includes() do to a partial search for a state

Upvotes: 2

Related Questions