Template variables {{}} on main/index view


#1

When I load data object into app.data I can access this in html through {{$root.myData}}.
This only seems to work on later initialized pages that are loaded via AJAX.
On main view (index.html), which is initialized in app.js via:

var mainView = app.views.create('.view-main', {
 url: '/'
});

I can not access this data via {{}} template variables. Is there an explanation/solution for this?

Thank you all! :wink:


#2

You need to follow this guide and load home page via router too http://framework7.io/docs/view.html#initial-page-route


#3

We followed this guide and the index is loaded via ajax but vars in {{var}} still do not work.

in the app.js:
var mainView = app.views.create(’.view-main’, {
url: β€˜/’
});

and in the routes:
routes = [
{
path: β€˜/’,
url: β€˜./pages/home.html’,
},…


#4

It must be templateUrl instead of url in home route