Note that there are some explanatory texts on larger screens.

plurals
  1. PODurandal: Can not pass activationData in compose with child router
    primarykey
    data
    text
    <p>Durandal 2.0.1. I have main router and child router for one of the main routes, the code of the shell module for that route (coffee):</p> <pre><code>define ['plugins/router'], (router) -&gt; router = router.createChildRouter().makeRelative({ fromParent: true }) return { activationData: null router: router activate: () -&gt; @activationData = &lt;some data&gt; routes = &lt;child routes&gt; router.reset().map(routes).buildNavigationModel() return } </code></pre> <p>Html for the shell module of that route:</p> <pre><code>&lt;div class="tab-sub-links"&gt; &lt;!-- ko foreach: router.navigationModel --&gt; &lt;a tabindex="-1" data-bind="css: { active: isActive }, attr: { href: hash }, text: title"&gt;&lt;/a&gt; &lt;!-- /ko --&gt; &lt;div class="clearfix"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="tab-content"&gt; &lt;div class="content-wrapper" data-bind="router: { transition: 'entrance', cacheViews: true, activate: true, activationData: activationData }"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>one of child modules:</p> <pre><code>define ['knockout'], (ko) -&gt; return { mainData: null activate: (activationData)-&gt; @mainData = activationData //always undefined return } </code></pre> <p>The problem is: activation data is not passed to child view. I digged in compose.js and found out that activationData is passed when model is passed to compose, in my view-binding model is router.activeItem, but activeItem is empty until route is activated and compose is running before that. Why? What should I do?</p> <p><strong>EDIT:</strong></p> <p>changed binding from: </p> <pre><code>router: {cacheViews: false, activationData: activationData} </code></pre> <p>to: </p> <pre><code>compose: {model: router: activeItem, attached: router: attached, compositionComplete: router.compositionComplete, cacheViews: false, activationData: activationData} </code></pre> <p>to no avail, and that was expectable, because router binding passes params to compose binding, so thees two records actually do the same.</p>
    singulars
    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.
    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