Note that there are some explanatory texts on larger screens.

plurals
  1. POActivate Function in composed view in Durandal
    primarykey
    data
    text
    <p>I have Shell html like this</p> <pre><code>&lt;div data-bind="compose: { model: 'ui/user/viewmodels/header', view: 'infoveave/user/views/header'}"&gt;&lt;/div&gt; &lt;div class="container-fluid page-host"&gt; &lt;!--ko compose: { model: router.activeItem, afterCompose: router.afterCompose, transition:'entrance' }--&gt;&lt;!--/ko--&gt; &lt;/div&gt; </code></pre> <p>and shell js like</p> <pre><code>define(function(require) { var router = require('durandal/plugins/router'), system = require('durandal/system'), return { router: router, activate: function () { var self = this; router.mapAuto('ui/user/viewmodels'); system.log('Sheel Activate Called'); return router.activate('dashboard'); } }; }); </code></pre> <p>the problem is the activate function on the header doesn't get called but the one on the dashboard gets called, I have to fetch some ajax content in the header and bind it, How can i achieve this</p> <p>I want to keep this logic separate as i don't want my shell to have this logic</p> <p>for reference my header (for simplification i have converted my complex model to a simple observable</p> <pre><code>define(function (require) { var router = require('durandal/plugins/router'), system = require('durandal/system'); this.userInfo = ko.observable(''); return { router: router, activate: function () { system.log('Got Called Now'); //do some ajax stuff here and update userinfo } }; }); </code></pre> <p>the simplest form of header html is </p> <pre><code>&lt;span class="dropdown-notif" data-bind="text: userInfo"&gt;&lt;/span&gt; </code></pre>
    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.
    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