Skip to content

Instantly share code, notes, and snippets.

@mwilc0x
Created December 2, 2013 15:53
Show Gist options
  • Save mwilc0x/7751597 to your computer and use it in GitHub Desktop.
Save mwilc0x/7751597 to your computer and use it in GitHub Desktop.
// inject $rootScope into application when we bootstrap
// call below line of code when save is called after
// client has been switched (ie. we have called the re-assign dialog and user clicked continue)
$rootScope.$broadcast('clientChange');
app.controller('MainCtrl', function MainCtrl() {
$scope.MainClientSelected = {};
$scope.Client2Selected = {};
function updateDependants(users) {
$scope.current_users = users.users;
$scope.$apply();
}
function updateStockOptions(users) {
$scope.current_users = users.users;
$scope.$apply();
}
// add more functions for each section that depends on client change
$scope.$on('clientChange', function (evt, users) {
updateDependants(users);
updateStockOptions(users);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment