knockout.js - Knockout Durandal compose view $root access -
i using hot spa template (which uses knockout , durandal) display on screen. html code getting long i'm trying split , dice smaller reusable components.
the code renders find , shows expect to. seem have lost handle main viewmodel
from main view, tried
<!-- ko if: --> <!--ko compose: { model: $data, view: '../tmpl/a'} --> <!--/ko--> <!--/ko-->
in tmpl/a.html file, have following:
<!-- ko foreach: array --> <!--ko compose: { model: $data, view: '../tmpl/tmpl1'} --> <!--/ko--> <!--/ko-->
now within /tmpl/tmpl1 tried bind button model
it nothing @ all. appears within /tmpl/tmpl1 can see array item. tried print out
<div data-bind="text: ko.tojson($data)"></div> <div data-bind="text: ko.tojson($root)"></div>
both shows array item.
please advise can do.
Comments
Post a Comment