Skip to content

Commit

Permalink
stop stickyfill when the component is removed from the dom
Browse files Browse the repository at this point in the history
  • Loading branch information
Corey Wilson committed Mar 4, 2016
1 parent 84baca5 commit e54519d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/angular-stickyfill.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* An Angular directive for stickyfill (position sticky polyfill)
* @version v0.0.2 - 2016-03-02
* @author corey wilson <[email protected]>
* @version v0.0.3 - 2016-03-04
* @author Corey Wilson <[email protected]>
* @license Unlicense, http://unlicense.org/
*/
(function (window, angular) {
Expand All @@ -23,7 +23,11 @@
throw new Error('stickyfill.js not loaded')
}

window.Stickyfill.add(element[0])
window.Stickyfill.add(element[0]);

scope.$on('$destroy', function() {
window.Stickyfill.remove(element[0]);
});
}
}
})(window, window.angular);

0 comments on commit e54519d

Please sign in to comment.