This commit is contained in:
Julius Haertl
2016-06-20 10:44:41 +02:00
parent ba8283dcdf
commit c0a9f010a8
28 changed files with 691 additions and 106 deletions

View File

@@ -17,10 +17,27 @@ app.factory('StackService', function(ApiService, $http, $q){
}
StackService.prototype.addCard = function(entity) {
console.log(this.data[entity.stackId]);
this.data[entity.stackId].cards.push(entity);
}
service = new StackService($http, 'stacks', $q)
StackService.prototype.updateCard = function(entity) {
var self = this;
var cards = this.data[entity.stackId].cards;
for(var i=0;i<cards.length;i++) {
if(cards[i].id == entity.id) {
cards[i] = entity;
}
}
}
StackService.prototype.deleteCard = function(entity) {
var self = this;
var cards = this.data[entity.stackId].cards;
for(var i=0;i<cards.length;i++) {
if(cards[i].id == entity.id) {
cards.splice(i, 1);
}
}
}
service = new StackService($http, 'stacks', $q);
return service;
});