Reputation: 41
I'm writing an application on node.js I need to insert a Static Google Map. The code looks like this
.panel.panel-primary
.panel-heading
h2.panel-title On the map
.panel-body
img.img-responsive.img-rounded(src="http://maps.googleapis.com/maps/api/staticmap?center=#{location.coords.lat},#{location.coords.lng}&zoom=17&size=400x350&sensor=false&markers=#{location.coords.lat},#{location.coords.lng}&scale=2&key=AIzaSyDt0D6sy4v8BZFVJiAea93aiR63E-GpBL8")
Controller, from where information about coordinates is taken
res.render('location-info', {
title: 'empty',
pageHeader: {title: 'empty'},
sidebar: {
context: 'empty',
callToAction: 'empty.'
},
location: {
name: 'empty',
address: 'empty',
rating: 5,
facilities: ['empty'],
coords: {lat: 55.752813, lng: 37.791908},
openingTimes: [{
days: 'empty',
opening: '19:00',
closing: '01:00',
closet: false
},{
How it looks like. When im try to copy someone else's code, everything works fine. Help! Thank you in advance.
Upvotes: 3
Views: 8820
Reputation: 370999
Template literals use $
, eg ${varNameHere}
- not #{location.coords.lat}
.
Try:
src="http://maps.googleapis.com/maps/api/staticmap?center=${location.coords.lat},${location.coords.lng}&zoom=17&size=400x350&sensor=false&markers=${location.coords.lat},${location.coords.lng}&scale=2&key=AIzaSyDt0D6sy4v8BZFVJiAea93aiR63E-GpBL8"
Upvotes: 4