Skip to content

Instantly share code, notes, and snippets.

@jusopi
Last active April 27, 2016 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jusopi/243e129314aea9cc13b2357c5d657e88 to your computer and use it in GitHub Desktop.
Save jusopi/243e129314aea9cc13b2357c5d657e88 to your computer and use it in GitHub Desktop.
.controller 'ClientDetailViewController', [
'$q'
'$state'
'adminService'
($q, $state, adminService)->
class ClientDetailViewController
resourceType:'client'
adminData:
regions: [
'east'
'midwest'
'west'
'south'
]
sizes: {
'small'
'medium'
'large'
}
constructor: ->
clientId = $state.current?.client_id
isNew = clientId is 'new'
if !isNew and clientId
adminService.getClient clientId
.then (rsp)=> @viewData = rsp
.catch (err)-> $q.reject err
adminService.getClients()
.then (rsp)=> @listData = rsp
.catch (err)-> $q.reject err
new ClientDetailViewController()
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment