Electrton js pass data to ejs tempalte


#1

Hi all. I am using ejs as a template engine. So now I need to pass a object data to my template.

Here is my main.js

function showTemplate(template, data) {
    mainWindow.loadURL(url.format({
        pathname: path.join(__dirname, APP.TemplatesPath, template),
        protocol: 'file:',
        slashes: true
    }), data);
}

 sendPostRequest('GET', 'user/get_accounts', {}, function (res) {
         res = JSON.parse(res);
       if (res.status === true) {
   
             var accounts = res.result.accounts;
            var currencies = res.result.currencies;
                 ejs = new electronEjs({accounts: accounts, currencies: currencies, a: 'A'});
   
          showTemplate(APP.Templates.Account, {accounts: accounts, currencies: currencies, a: 'A'});
      }
     }, true);

So but as a response I am getting (a not defined). Please Help!