Notice: The Monaca & Onsen UI Community Forum is shutting down.
For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.
Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.
Newbie Question about templates
leroy_hack last edited by
onsenui.min.js:2 Uncaught (in promise) TypeError: Cannot read property 'remove' of undefined at Object.Q.createElement (onsenui.min.js:2) at onsenui.min.js:2
So I don’t understand why the template IDs have to be real pages. Or why would a template would be used instead of using ons-page.
Can someone help me understand templates?
Templates are fragments of HTML that are not rendered immediately when a page is loaded, but can be rendered later. This is useful for speeding up loading times because templates don’t need to be rendered when the app starts. For example, if your app contains a page in a template and the user never visits that page, the page will never be rendered. If you hadn’t used a template, the page would have been rendered even though the user never visited it.
In Onsen UI, there are two ways of defining pages that the navigator can load. One is by using the
<template> <ons-page>...</ons-page> </template>
The other way is to define a page in a separate file (without the
A template isn’t used instead of ons-page.
ons-pagedefines an Onsen UI page;
templatelets the browser know that it shouldn’t be loaded at startup.
I hope that helps. If you still have questions please let us know.