Define a separate HTML fragment and use as a template. These templates can be loaded as pages in <ons-navigator>, <ons-tabbar> and <ons-splitter>. They can also be used to generate dialogs. Since Onsen UI 2.4.0, the native <template> element can be used instead of <ons-template> for better performance and features. <ons-template> is still supported for backward compatibility.


<ons-template id="foobar.html">
    Page content
<ons-navigator page="foobar.html"></ons-navigator>

See also

Properties are accessed on the element through JS, and should be get and set directly. For example: document.querySelector('ons-template').template.

Name Description
template Template content. This property can not be used with AngularJS bindings.

Need Help?

If you have any questions, use our Community Forum or talk to us on Discord chat. The Onsen UI team and your peers in the community will work together to help solve your issues.

For bug reports and feature requests use our GitHub Issues page.