LP#1642378 Webstaff org selector misc. repairs
authorBill Erickson <berickxx@gmail.com>
Mon, 27 Feb 2017 21:43:09 +0000 (16:43 -0500)
committerBill Erickson <berickxx@gmail.com>
Mon, 27 Feb 2017 21:50:31 +0000 (16:50 -0500)
commitb1118efc35b9b4efb381485829b7d27369dc152b
treec4688f588aeb9a486f4ed096ed23b5a01e3cc5ff
parent4f2117f2016dc5542e9c5b45069c653d65f243c1
LP#1642378 Webstaff org selector misc. repairs

1. Always apply default values after egStartup.go() has completed.
   Among other things, this prevents the occaisonal "cannot call ws_ou()
   on an undefined value" errors bubbling up from the org selector
   when an attempt to set default values occured before egAuth had
   retrieved the user (which occurs during startup).

2. For consistency, always run the $scope.onchange handler on initial
   page load when a selected value and change handler are defined.
   Similar to #1 above, the initial onchange always fires after
   egStartup has completed.

3. Run the change handler in a $timeout so that the $scope.selected
   value has a chance to propagate to the calling controller's $scope.
   Otherwise, the the calling controller has to manually track the
   selected value (which partially defeats the purpose of having this
   directive in the first place).

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/web/js/ui/default/staff/services/ui.js