Attached is firing when I navigate Away from the page

15 views
Skip to first unread message

Ted Hughes

unread,
Feb 3, 2015, 12:21:03 PM2/3/15
to duran...@googlegroups.com
When I toggle back and forth between 2 pages the Attached method is being called on the page that I am leaving. I am using version 2.1.0. So when I navigate from page A to page B , page A's Attached method is called and eventually it's Deactivate is called (Activate on page A is not called again) as well as page B's Activate and Attached appropriately.

I see this happen in the triggerAttach(context, element) method in composition.js. The context.activeView and the context.child at this point end up being the same object and therefore it does remove the ActiveViewAttributeName successfully but then proceeds to call attached on the child, which is the same object.

You have to toggle back and fourth a couple of times to see this happen. Not sure if I am suppose to handle some cleanup that I am not doing?

Is this happening to anyone else?

Ted Hughes

unread,
Feb 3, 2015, 4:19:39 PM2/3/15
to duran...@googlegroups.com
I discovered the issue. I am using typescript and I have created a base view for all my view modules. This view contains a reference to the durandal router. In my derived view that extends the base view, I call the router to navigate. Not entirely sure why , but that creates the issue. removing the router from the base view solved my problem.
Reply all
Reply to author
Forward
0 new messages