Skip to content

Commit

Permalink
cardComponent being deleted from this.swingStack.cards is now this of…
Browse files Browse the repository at this point in the history
… swing-card-component rather than assuming it will always be the cardComponent at the end of the array
  • Loading branch information
Sparkomatic committed Jun 24, 2017
1 parent f3be87b commit 0c4207f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/swing-card-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {Card} from './swing';
export class SwingCardComponent {
@Input() prepend: boolean = false;

card: Card;

constructor(
private elmentRef: ElementRef,
private swingStack: SwingStackComponent) {
Expand All @@ -33,8 +35,8 @@ export class SwingCardComponent {
}

destroyCard() {
this.swingStack.cards.pop();
var card = this.swingStack.stack.getCard(this.getNativeElement());
this.swingStack.stack.destroyCard(card);
}
this.swingStack.cards = this.swingStack.cards.filter(swingCardComponent => swingCardComponent !== this);
let card = this.swingStack.stack.getCard(this.getNativeElement());
this.swingStack.stack.destroyCard(card);
}
}

0 comments on commit 0c4207f

Please sign in to comment.