I have a problem displaying information in an array with windows 8 app, I send information to the view with this.
var details = document.querySelector(".articlesection");
var data = [{
"id": "1",
"title": "Title text",
"files": [
{
"id": "1",
"title": "File1"
},
{
"id": "2",
"title": "File2"
}
]
}];
binding.processAll(details, data);
I receive the data in the view like this (This works, but cant get info from the files array)
<div class="articlesection">
<h2 data-win-bind="textContent: title">
<!-- Displays 1 -->
</h2>
<h3 data-win-bind="textContent: id">
<!-- Displays "Title text" -->
</h3>
</div>
How can i make it show the 2 objects in the array? If I try
<div class="articlesection">
<h2 data-win-bind="textContent: title">
<!-- Displays 1 -->
</h2>
<h3 data-win-bind="textContent: id">
<!-- Displays "Title text" -->
</h3>
<p data-win-bind="textContent: files">
<!-- i get [Object object], [Object object] -->
</p>
</div>
So clearly here is some data, So how can I do it if I want it like this. (Foreach doesnt exists, but I wanted to show how I want to do)
<div class="articlesection">
<h2 data-win-bind="textContent: title">
<!-- Displays 1 -->
</h2>
<h3 data-win-bind="textContent: id">
<!-- Displays "Title text" -->
</h3>
<ul data-win-bind: foreach: files>
<!-- Foreach all files, how can I do this? Foreach doesn't exist. -->
<li>
<span data-win-bind="textContent: id"></span>
<span data-win-bind="textContent: title"></span>
</li>
</ul>
</div>
Regards, Jim