0
I have the following array created in my controller:
var data = [];
for (var i = 0; i < array.length; i++) {
nfejs(array[i], function(err, nfe) {
var itemNfe = {};
itemNfe.name = nfe.identificador.getNumero();
data.push(itemNfe);
});
}
nfe.data = data;
Which is generated as follows:
data:[{
name: {type: String, required: true, trim: true, default: ""},
}],
I’m trying to read in jade as below, but it doesn’t work:
table#nfe.table.table-striped.table-bordered.table-hover.dt-responsive
thead
tr
th(style='text-align: center') Nome
th(style='text-align: center; width: 25%') Ação
tbody
for nfe in nfes
tr
td(style='text-align: center') #{nfe[data].name}
I’m not in trouble to assemble the array, the same is correct. My difficulty is in how to read in jade.
– Nodejs
@Nodejs ok, if the function
nfejs
It’s synchronous, so all you need to do is correct Jade. I added that to the answer.– Sergio
@Nodejs one possible question: are you passing the
nfes
for the right Jade? in this case I put in the answereach nfe in nfes.data
, but if you’ve only passednfes.data
for Jade, you can have onlyeach nfe in nfes
or the variable you use.– Sergio