Asked by:
Binding HtmlControl Source Uri winjs

Question
-
hello guys,, i m have a list of pages and i want to have a template that renders a list of pages...
After some reasearch i read that to bind a data-win-options property we should use winControl, but i tried and it doesn't work. i get a error saying the uri property doesn't exist.
If i take the div HtmlControl out, and use a iframe, and bind to the src of the iframe, it works.
<div id="bluePrintTemplate" data-win-control="WinJS.Binding.Template" style="display: none">
<div id="blueprintItem">
<h2 data-win-bind="innerText: Name" class="label"></h2>
<div class="content" data-win-control="WinJS.UI.HtmlControl" data-win-bind="winControl.uri: Url">
</div>
</div>
</div>any help isapreciated :)
thanks
Rui
Monday, May 14, 2012 6:27 PM
All replies
-
no help?Thursday, May 17, 2012 5:34 PM
-
Hi Rui,
The error message is telling you the correct thing. The Html control does not have a Url property correct? If it does not exist, you cannot set it.
You need to use some object that has a Url property, perhaps an <iframe> would work for you? Why do you want to use that particular control?
-Jeff
Jeff Sanders (MSFT)
- Proposed as answer by Jeff SandersMicrosoft employee, Moderator Thursday, May 17, 2012 6:25 PM
Thursday, May 17, 2012 6:25 PMModerator -
Humm i don't think you are right, it doesn't have a Url.. Htmlcontrol has a URI property like this:
<div id="contentlisthost" data-win-control="WinJS.UI.HtmlControl" data-win-options="{uri: '/html/blueprints/pageTest.html'}"> </div>
So this works if i set the uri ,but when iuse this inside a template and try to bind my URL property the URI property of the control like this
<div class="contentlisthost" data-win-control="WinJS.UI.HtmlControl" data-win-bind="winControl.uri: Url">
it fails!
Monday, May 21, 2012 11:44 AM -
That is an options parameter and not a property of the object. The way the binding works is to bind to a property of the object. The <iframe> object does have a src property so you could use the iframe object. Does that clear things up for you?
-Jeff
Jeff Sanders (MSFT)
- Proposed as answer by Jeff SandersMicrosoft employee, Moderator Tuesday, May 22, 2012 6:39 PM
Tuesday, May 22, 2012 6:39 PMModerator