Update views and router to use window for dependencies

Updated views and router to use the window to declare dependencies.
Fixed trigger statement in router by wrapping in an object.