javascript - knockout - get value from parent array -
below snippet of html containing knockout bindings. if first/outer foreach loop goes through array called tradesobservablearray contains key called "threadid", how can value have: **$root.threadid**? please note $root.threadid in inner foreach loop.
basically, $root.threadid returns undefined. i've tried $parent.threadid same result.
thanks in advance ...
<div id="tradesthread" data-bind="foreach: tradesobservablearray"> <table> <tbody data-bind="foreach: $root.filesobservablearray"> <tr id="traderow"> <td data-bind="visible: $root.traderowfiles(**$root.threadid**, commentid)"><span data-bind="text: filename"></span></td> </tr> </tbody> </table> </div>
if threadid
observable object can value calling:
$parent.threadid()
Comments
Post a Comment