Last active
April 27, 2016 13:37
-
-
Save jusopi/243e129314aea9cc13b2357c5d657e88 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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