Created
May 20, 2013 20:39
-
-
Save brianium/5615333 to your computer and use it in GitHub Desktop.
angular service
This file contains hidden or 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
/** | |
* 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