View HTML

Rico Suter edited this page Sep 23, 2015 · 5 revisions

Each view must have a view HTML file which can be found in the views directory. The filename is composed of the view name and the extension .html. The HTML markup defines the appearance of the view and contains bindings to the view's view model.

Support for multiple view instances

To avoid problems with multiple view instances you should never select an element by ID. To access a specific element, add a vs-id attribute and use the getViewElement() method to get the element:

<div>
	<div vs-id="myDiv"></div>
</div>

To load the element in the view "code-behind" class, use the getViewELement() method:

var element = this.getViewElement("myDiv");

If you need to generate view specific IDs, use the [[viewId]] placeholder which automatically gets replaced by the View ID. Sample:

<label for="myInput_[[viewId]]">My label</label>
<input type="text" id="myInput_[[viewId]]" value="My text"></input>
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.