I am new to Angular.js and I cannot figure out how to solve my problem.
The application consists of three main tabs, which are also top-level routes, i.e.
#/home
The current route configuration looks something like this (coffeescript):
$routeProvider. when('/home', templateUrl: 'home.html'). when('/inbox', templateUrl: 'inbox.html'). when('/inbox/:thread_id', templateUrl: 'inbox.html', controller: 'MessagesCtrl'). otherwise(redirectTo: '/inbox')
Now the problem is viewing incoming messages .
Inbox view ( inbox.html ) is a split column template containing a list of message flows on the left and messages of the selected stream on the right:
-------------------------- | Navigation | -------------------------- | | | | Threads | Messages | | | | | | |
The stream list should be visible for all #/inbox routes, regardless of whether the stream is selected or not.
As you can see from the routes, the inbox view is a separate template ( inbox.html ), which is loaded both when a stream is selected and in its absence. This allows Angular to re-render the entire view every time a stream is selected, which also causes the list of streams (on the right) to re-display and lose its scroll position.
I would like the thread list to be redrawn whenever a thread is selected, and I cannot figure out how to organize my routes / patterns to achieve this.
Any suggestions would be greatly appreciated!
source share