Pass app root data to index.html

I am really new to framework7, and just try to pass app root data to html. This is my app.js.

var app = new Framework7({
root: ‘#app’, // App root element
id: ‘io.framework7.testapp’, // App bundle ID
name: ‘Framework7’, // App name
theme: ‘auto’, // Automatic theme detection

// App root data
data: function () {
return {
username: ‘john’
So how can I pass the data into index.html with js template? I have tried the following code, but I got Illegal return statement error…

Hello, my name is {{name}}

I am appreciated if anyone could help me.

I have tried a few things, should I use something like this in index.html?

{{ $root.username }}

You need to load home page with router

1 Like