angular-deckgrid
angular-deckgrid copied to clipboard
Fix a bug about destroy
Bug: when we switch from one state (page) to another, and we have deckgrid in both states, then new deckgrid is created, then destroy is called... but is called for just created new deckgrid instead of old one.
Reason: angular calls directive function only once. So that we always have the only instance of Descriptor (and several inctances of Deckgrid). Hence, descriptor.$$deckgrid will always point to the recently assigned deckgrid.
Fix: instead of using $$destroy in Descriptor (that has one instance only), use destroy of deckgrid directly (specifying correct instance of DeckGrid, so that I bind it to just created instance of DeckGrid in $$link function).