Hi, I have a problem with passing params from a list view. I read others questions inside the forum, but i can’t resolve the issue. I 'm creating a list view dynamically. What I’m trying to do is to pass the name text of the ‘a’ element because I need that name for the next page where the user is directed after clicked on the element list.
I’m trying to do its in this way:
This is the col where I append dynamically the list view inside main.html
this is the method that generates dynamically the list inside company.js
const createListCompany = (nameCompany) =>{
var li = document.createElement("div");
var a = document.createElement("a");
a.href = 'view/?name=' + nameCompany; //here I try to pass the name
a.text = nameCompany;
a.className ='item-title';
li.appendChild(a);
document.querySelector('#listCompany')
.appendChild(li)
.appendChild(a);
}
this is the myapp.js
the url: /pages/company/main.html is the view where I generate the list dynamically. The other is the page where I redirect the user after selected an element list.
{
name: 'company',
path: '/company/',
url: './pages/company/main.html',
},
{
name: 'company-view',
path: 'view/:name', //I add this to retrieve the value
url: './pages/company/view.html',
on: {
pageInit: function(e,page){
var p = app.page.route.params();
}
},
},