I want to load a template via ajax through my routes.
This is my sub routes object and I’m trying to load the template as a string via ajax.
{
path:‘play’,
async:function (routeTo, routeFrom, resolve, reject) {
// Router instance
var router = this;
var lectionId = routeTo.params.lectionId;// App instance var app = router.app; // Show Preloader app.preloader.show(); app.request.get('/GameOn/Lection/' + lectionId+'/play', function (data) { app.preloader.hide(); app.panel.close(); resolve({ template: data, }); }); } }
This is my template:
<template>
<div class="page" data-name="play-lection">
<div class="navbar">
<div class="navbar-inner sliding">
<div class="left">
<a class="back link" data-ignore-cache="true" data-force="true">
<i class="icon icon-back"></i>
<span class="ios-only">Back</span>
</a>
</div>
<div class="title">Lektionen zu </div>
</div>
</div>
<div class="page-content">
<div class="block">
<div class="block">
</div>
</div>
</div>
</div>
</template>
I’m using the tabbed-view layout template from the docs. I can’t load this template into any view, not with the data-name attribute nor with the data-view attribute.
I would like to know how to load the template into a view.