I can't figure out why this code isn't functioning as anticipated:
func = ->
deferObj = $q.defer()
$timeout ->
deferObj.resolve({foo:'bar'})
,1000
return deferObj.promise
showData = (data)->
console.log(data.foo)
func().then(showData) # not working as expected
func().then((data)-> showData(data)) # works perfectly when used like this - prints "bar"
Why is the then
method not properly curried as expected?