homerjam / angular-gsapify-router

Angular UI-Router animation directive allowing configuration of GSAP state transitions based on priority
http://homerjam.github.io/angular-gsapify-router/
MIT License
85 stars 16 forks source link

not firing gsapify router on initial app load #7

Closed oliodj closed 9 years ago

oliodj commented 9 years ago

hey

this might be a bit hacky but:

wrapping lines 252-257 in a timeout allows passing state.data through to the self.$get function on initial app load

any chance of getting this included?

ta

EDIT: that suggested fix causes other issues, sorry ignore it

oliodj commented 9 years ago

could line 146 be optional?

var duration = $state.previous.name === '' ? 0 : from.duration, // don't trigger transition on boot

homerjam commented 9 years ago

What are you actually trying to do? Animate a state in at the beginning?

If so then the simplest thing to do is probably just trigger the state by forcing the transition with $state.go('stateName', {reload: true}) or switching to a blank intermediary state and then immediately switching back.

oliodj commented 9 years ago

exactly. have been figuring out workarounds to trigger a transition on boot on every site I've used this on, feels a bit hacky though. would making transition on boot configurable cause any issues? if not I don't mind making a pull request...

homerjam commented 9 years ago

Well it would be a pretty major change - the reason its setup this way is to mirror the behaviour of ui-router which doesn't cause a transition on initial load, I've taken this to be the expected behaviour now.

The obvious place for this option would be the provider, you'd then set it in the config stage of the app:

gsapifyRouterProvider.initialTransitionEnabled = true; // false by default

Would definitely take a PR for that...

oliodj commented 9 years ago

Ah ok, great have sent a PR