title: Durandal: how to properly make ajax requests in shell activate function
body: <p>When my SPA initializes it has to make some ajax calls that need to run before any views get loaded. I have placed these in the activate function of shell.js. In other views I return these calls from the activate function and all works fine. But in the shell I should return from the router.activate call. How to to return the proper view and assure that those ajax calls are made? What I see is the data doesn't always load.</p>
  
  <pre><code> activate: function () {
  
              var query =
             $.when(
                      datacontext.getCurrentUser(),
                      datacontext.getGroupsAuthorized(),
                      datacontext.getTeams(),
                      datacontext.getRoles(),
                      datacontext.checkPermissions('views.shell')
                      )
              .then(function (s0, s1, s2,s3, s4) {    
                  /* code excluded */        
              },
              function (f0, f1, f2) {
                 /* code excluded */
  
              }).always( function() {
                  /* code excluded */                   
              });
  
              return router.activate('welcome');
  
      },
  </code></pre>
  
  <p>all of the datacontext calls look something like this:</p>
  
  <pre><code>getCurrentUser = function () {          
         return $.ajax({
             url: 'api/currentuser/',
             type: 'GET'
         });
     },
  </code></pre>