Skip to content

Instantly share code, notes, and snippets.

@mxmzb
Created March 11, 2016 02:22
Show Gist options
  • Save mxmzb/1eab3627b1fce7a0c091 to your computer and use it in GitHub Desktop.
Save mxmzb/1eab3627b1fce7a0c091 to your computer and use it in GitHub Desktop.
app
.factory('components', [
'$http',
'SERVER',
function($http, SERVER) {
var o = {
component: {},
components: [],
componentExercises: []
};
o.getAll = function(session) {
angular.copy(session.components, o.components);
};
o.getComponentExercises = function(array) {
if(array.length > 0) {
return $http({
method: 'GET',
url: '/api/exercises?ids=' + array.join()
}).success(function(res) {
angular.copy(res, o.componentExercises);
});
}
}
return o;
}])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment