Skip to content

Commit aeed4ed

Browse files
author
Brian Hines
committed
Merge pull request #3 from clementlamoureux/patch-1
Added cleaning on directive destroy
2 parents e34ca4b + 710f576 commit aeed4ed

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

angular-skycons.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ angularSkycons.directive( 'skycon', function () {
5454
} else {
5555
element[0].appendChild( canvas );
5656
}
57+
58+
scope.$on('$destroy', function () {
59+
skycons.remove(canvas);
60+
if (skycons.list.length === 0) {
61+
skycons.pause(canvas);
62+
}
63+
});
5764
}
5865
};
5966
} );

0 commit comments

Comments
 (0)