ViewModel-less compose with model.bind in aurelia -


i having structure main view composes partial view composes partial view in repeater.

example:

main view

<template>     <h1>${factory.name}</h1>     <div class="column">         <compose view="./cars.html"></compose>     </div> </template> 

cars view

<template repeat.for="car of factory.cars">     <compose view="./specifications.html model.bind="{test: 'abc}"></compose> </template> 

specifications view

<template repeat.for="car of factory.cars">     <h1>${$parent.$parent.factory.name} - ${car.name}</h1>     ${test} </template> 

the problem facing model.bind in compose doesn't work. tried test above, i'd want pass there $parent.$parent.factory can output $parent.$parent.factory.name in specifications view.

(i know can print this, scenario gets way more complicated binding necessary)

worth mention both specifications , cars view viewmodel-less. themain view has viewmodel factory , cars coming from.

according page, trying possible, can't wrap head i'm doing wrong.

when composing html file, view-model referenced html file same compose element placed. in other words, inherits view-model of parent. don't need supply model.

main view

<template>     <h1>${factory.name}</h1>     <div>         <compose view="./cars.html"></compose>     </div> </template> 

cars.html

<template>   <div  repeat.for="car of factory.cars">     <compose view="./specifications.html"></compose>   </div> </template> 

specifications.html

<template>     <h1>${factory.name} - ${car.name}</h1> </template> 

take @ gistrun example.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -