0
var express = require('express');
var router = express.Router();
var data = {
curreny :{
name:'United States dollars',
abbrev:'USD'
},
tours:[
{name: 'Hood River' , price:'100'},
{name: 'Sri lanka' , price:'150'},
{name: 'Hood River' , price:'178'}
],
specialsUrl:'/january-specials'
}
router.get('/detour',function(req,res){
res.render('tours',{object:data});
})
module.exports = router;
以上內容我用JSON對象導出到車把的代碼來訪問數組元素中JSON對象。我需要在句柄文件中訪問巡視數組中的巡視細節。我如何訪問這些詳細信息來製作h3標籤中的旅遊細節列表。以下是示例tour.handlebars文件。提前致謝。
<h2> Hello this is the body section</h2>
<h3>currency : {{object.curreny.name}}</h3>
<h3>tours : {{object.tours.body}}</h3>