質問

map.on "click", (e) ->
  if count >= 2
    map.removeLayer(newMarkerGroup)
    count = 0
    return
  else
    newMarker = new L.marker(e.latlng).addTo(map)
    count= count+1
    return

Why am I getting the unexpected if statement, I think my code is properly indented?!

役に立ちましたか?

解決

Found the solution. Notepad ++ was acting strange, it was immediately adding tab when it sees 4 white spaces, and coffeescript didn't like it. Just turn off that option in Notepad++.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top