3

I have outer routes: /posts and /about. /posts route has nested routes: / and /pages/:pageNumber.

When navigating between nested routes (/ and /pages/:pageNumber) animations work well. But when navigating to /about nested route immediately disappears.

animateChild() doesn't help. In parent router component animation:

transition(':leave', [
  query('@*', animateChild()),
  animate('/*some easing*/', style({/*some styles*/}))
])

This causes error query("@*") returned zero elements.. So nested route is removed immediately, parent component can't see it.

Angular version: 4.2.2

Lucas
  • 9,871
  • 5
  • 42
  • 52
GProst
  • 9,229
  • 3
  • 25
  • 47
  • Been looking all over the webs for a solution to this. Seems like it should be a common occurrence. – daleyjem Nov 08 '17 at 00:10

1 Answers1

0

For me, the cause of the problem was that, when navigating from /page1 to /page2, in page2.component.ts I was loading some data from the server in the constructor. Moving that code to ngOnInit solved this issue, after 2 weeks of breaking my head.

Luis Araujo
  • 91
  • 1
  • 4