Note that there are some explanatory texts on larger screens.

plurals
  1. POAngularJS - templating with sub-routes
    primarykey
    data
    text
    <p>I'm quite new to Angular.js and I can't seem to figure out how to solve my problem.</p> <p><strong>The app</strong> consists of three main tabs which are also top-level routes, ie.</p> <pre><code>#/home #/inbox #/products </code></pre> <p>The current route-configuration looks something like this (coffeescript):</p> <pre><code>$routeProvider. when('/home', templateUrl: 'home.html'). when('/inbox', templateUrl: 'inbox.html'). when('/inbox/:thread_id', templateUrl: 'inbox.html', controller: 'MessagesCtrl'). otherwise(redirectTo: '/inbox') </code></pre> <p>Now, the <strong>problem is the inbox view</strong>. </p> <p>The inbox view (<code>inbox.html</code>) is a split column template with a list of message-threads to the left and the messages of the selected thread to the right:</p> <pre><code> -------------------------- | Navigation | -------------------------- | | | | Threads | Messages | | | | | | | </code></pre> <p>The list of threads should be visible for all <code>#/inbox</code> routes no matter if a thread has been selected or not.</p> <p>As you can see from the routes, the inbox view is a separate template (<code>inbox.html</code>) which is loaded both when a thread is selected and when it's not. This makes Angular re-render the entire view each time a thread is selected, which also causes the thread-list (to the right) to re-render and loose its scroll-position.</p> <p>I would like to keep the thread-list from re-render whenever a thread is selected and I can't seem to figure out how to organize my routes/templates in order to achieve this.</p> <p>Any suggestions would be greatly appreciated!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload