Skip to content

Instantly share code, notes, and snippets.

@brianium
Created May 20, 2013 20:39
Show Gist options
  • Save brianium/5615333 to your computer and use it in GitHub Desktop.
Save brianium/5615333 to your computer and use it in GitHub Desktop.
angular service
/**
* Sets up a model that depends on resource pools
* and catalogs
*/
angular.module("uss.services").
factory('CatalogItemModel', ['Catalog', 'ResourcePool', function(Catalog, ResourcePool) {
return {
setModel: function($scope, /** invoked with first cat */ cfn, /** invoked with first pool */ pfn) {
$scope.catalogs = Catalog.query({'public':0}, function(cats){
cfn(cats[0].id);
});
$scope.pools = ResourcePool.query(function(pools){
pfn(pools[0].id);
});
}
};
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment