Coffeescript:Uncaught RangeError:最大调用堆栈大小超过

时间:2016-07-18 15:05:48

标签: coffeescript

我有一个正常的coffeScript循环用于在谷歌地图上放置标记。但是,我收到了错误。这是代码。 P.S:2年后加入coffeeScript

layMarkers = ->
    $.ajax '/locations',
        type: 'GET'
        dataType: 'json'
        error: (jqXHR, textStatus, errorThrown) ->
            console.log errorThrown
        success: (data, textStatus, jqXHR) ->
            buses = data["locations"]
            for i in buses
              do (i) ->
                marker = new google.maps.Marker(position: new google.maps.LatLng(i["latitude"], i["longitude"]),
                map: map
                title: "#{i["number_plate"]}, #{i["speed"]}km/h"
                animation: google.maps.Animation.DROP)
                marker.setMap(map)
                marker.addListener 'click', ->
                  showDirection(i["terminal_number"], i["bus_number"], i["number_plate"],i["speed"] )
                  # infowindow("#{i["number_plate"]}, #{i["speed"]}km/h, Terminal: #{i["terminal_number"]}, Bus Number: #{i["bus_number"]}").open map, marker
                  return

如果可以,请协助。感谢

0 个答案:

没有答案