문제

How I can run my code when Durandal finishes view attach in shell.js?

I tried viewAttached : function(){} in my shell.js but it does not works.

All I want to do is when views loaded run some jQuery code

도움이 되었습니까?

해결책

You can see the view lifecycle here: http://durandaljs.com/documentation/Hooking-Lifecycle-Callbacks

In durandal 2.0 there is no more viewAttached, it has been renamed to attached

To Yasser - activate is happening first before viewmodel is attached to it's corresponding view so you can't access any DOM elements, attached comes after viewmodel and view are connected and you can access DOM elements

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top