0
我寫了波紋管代碼。我想回調方法沒有通過coffeescript返回
initialize : ->
@model.apiForecast = new ApiForecastModel(
model: @model.get('apiForecast')
)
@model.forecast = new ForecastModel(
model: @model.get('forecast')
)
cookie = Cookie()
forecastCall = this.model.forecast.fetch(
data:
token: cookie['Authorization']
headers:
Authorization: cookie['Authorization']
success: ->
console.log('Success Forecast')
error: (e) ->
console.log('Service request failure: ' + e)
)
$.when(forecastCall)
.done(() -> (
@getApiForecast()
return
).bind(@)
return
)
return
但是然後我得到了這個錯誤。
error: unexpected indentation
其實我想編譯成這樣的ajax代碼。
$.when(forecastCall).done(
function() {
this.getApiForecast();
}.bind(this)
);
你有什麼決議?