Skip to content

Instantly share code, notes, and snippets.

@diestrin
Created August 9, 2013 16:27
Show Gist options
  • Save diestrin/6195027 to your computer and use it in GitHub Desktop.
Save diestrin/6195027 to your computer and use it in GitHub Desktop.
app = angular.module 'app', []
app.factory 'API', ($http) ->
@get = (url) ->
$http.get(url).then (data) ->
# check if the data is complete
data
@
app.factory 'Auth', (API) ->
@login = (user, pass) ->
API.get("#{user/pass}").then (data) ->
data.name = data.name.toUppercase()
data
@
app.controller 'LoginCtrl', (Auth) ->
@user = Auth.login 'diego', 'barahona123'
@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment