Add more
This commit is contained in:
@@ -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;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user