我正在用 ruby on rails 制作一个应用程序,这是我的咖啡脚本文件之一,
我相信我的代码已正确缩进,但我仍然遇到错误。
我用下面的评论标记了给我错误的行。
请帮忙!
jQuery ->
today_date = new Date()
month = today_date.getMonth()
day = today_date.getDay()
pkpstyle= [
featureType: "landscape.natural"
elementType: "geometry"
stylers: [
lightness: -29
,
hue: "#ffee00"
,
saturation: 54
]
,
featureType: "poi.park"
stylers: [
lightness: -35
,
hue: "#005eff"
]
,
featureType: "road.arterial"
,
featureType: "road.arterial"
stylers: [ lightness: 45 ]
]
tempDay = 4
//I get an error here saying Uncaught TypeError: undefined is not a function
today_latlng = getLatlng(stops[tempDay])
markericon = new google.maps.MarkerImage("/assets/cycling.png")
myOptions =
center: today_latlng
zoom: 12
minZoom: 4
styles: pkpstyle
mapTypeId: google.maps.MapTypeId.ROADMAP
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions)
for i of stops
latlng = getLatlng(stops[i].latlng)
marker = new google.maps.Marker(
map: map
icon: markericon
position: latlng
)
getLatlng = (loc) ->
loc_split = loc.split(", ")
lat = loc_split[0]
lng = loc_split[1]
new google.maps.LatLng(lat, lng)