Handlebars: Access has been denied to resolve the Property "title" because it is not an "Own Property" of its Parent

Asked

Viewed 747 times

0

I’m having a problem with displaying mysql data by handlebars:

Executing (default): SELECT `id`, `titulo`, `conteudo`, `createdAt`, `updatedAt` FROM `postagens` AS `postagens`;
Handlebars: Access has been denied to resolve the property "titulo" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Handlebars: Access has been denied to resolve the property "conteudo" because it is not an "own property" of its parent.You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Es

2 answers

1


0

app.engine('handlebars', handlebars({
        defaultLayout: 'main',
        runtimeOptions: {
            allowProtoPropertiesByDefault: true,
            allowProtoMethodsByDefault: true,
        },
}))

WARNING: People can lock their system when manufacturing special models. Do not use the above code.

app.get('/pagamento', function (req, res) {
    Kitten.findAll().then(pagamentos => {
        res.render('pagamento', {
            pagamentos: pagamentos.map(pagamento => pagamento.toJSON())
        })
    })
});

Adapt your code in this example above.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.