Home Is there a way to distinguish whether the state is being triggered directly or through a child?
Reply: 0

Is there a way to distinguish whether the state is being triggered directly or through a child?

user693
1#
user693 Published in April 25, 2018, 7:49 pm

I need to find a way to know whether the user is navigating to a parent state directly or the state is being activated because a child is being activated.

Let's say I have these states:

var main = {
   name: 'main',
   url: '/main',
   component: 'main'
}

var child = {
   name: 'main.child',
   url: '/child',
   component: 'child'
}

I have a function in main component's controller that I only want to run when the user has navigated www.mysite.com!#/main and not run it if the user clicked on a url www.mysite.com!#/main/child

Is it possible to achieve?

I am using AngularJS and the latest version on router-ui.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.306995 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO