Tung Pham
Tung Pham

Reputation: 1

Can durandaljs has more than one shell.js?

I have 3 SPAs within one bigger project written by DuraldalJS (called A). Can A has 3 shell.js to load for each SPA? Thanks.

Upvotes: 0

Views: 60

Answers (1)

Marcel Posdijk
Marcel Posdijk

Reputation: 625

This is possible. You can create three files, e.g. shellA.js, shellB.js and shellC.js.

Per SPA you must create a server page, e.g. IndexA.html, IndexB.Html and IndexC.html.

You can create a global javascript settings object in each page:

  <script>
    var mySettings = mySettings || {};
    mySettings.entrance = 'viewmodels/shellA';
  </script>
  <script src="/js/requirejs/require.js" data-main="/app/main"></script>

In main.js you can configure your Durandal app like so:

var mySettings = mySettings || {};
app.setRoot(mySettings.entrance, 'entrance');

Upvotes: 0

Related Questions