angularjs - Getting "c.instantiate {}" returned as object when referencing a service -


i created geo location service:

angular.module('app') .service('geo', ['$http', ($http) ->   apiurl = 'http://freegeoip.net/json'    getdata = ->     $http.get(apiurl)       .success((data)->         console.log data       ) ]) 

then include service in controller:

@app.controller 'mycontroller', ['geo', (geo)->   geo.getdata() ] 

i error:

object [object object] has no method 'getdata'

inspecting geo gives me "c.instantiate {}"

what doing wrong here?

thanks.

turns out service had change getdata this.getdata work.


Comments