angular-ui/bootstrap — pull request #1451 by chrisirhc (2013-12-23 11:50:45+00:00)
Title: fix(carousel): cancel timer on scope destroyed

My take on this fix based on @joshkurz 's findings.

At first I thought that the go function should check if the scope is destroyed, but I realized that it doesn't have to as long as only one timeout can be set at one time. If only one timeout can be set at one time, the scope $destroyed event just has to cancel it.

I'm also thinking of moving the `go` function out of the `restartTimer` as the function is always the same doesn't need to be recreated on each timer run.

TODO:
- [ ] Move go function out of `restartTimer`

Fixes #1414