Skip to Content
Aug 25, 2015 at 06:48 AM

Is there any way we can call a view's controller even before the view is rendered?



I was trying to implement routing and noticed that the application flow is passed to view's controller only after the view is fully rendered.

What I have done is attached a handleRouteMatched to the view's controller which will be in charge of assigning value to a variable referred in the view according to the route's name.

When the URL with pattern is directly called, it obviously throws error because the variable is not assigned any value at that point in the view.

Is there any way we can have the handleRouteMatched of the controller called even before this view is rendered?