Pass app root data to index.html


#1

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 }}


#2

You need to load home page with router http://framework7.io/docs/view.html#initial-page-route