angular-ui/bootstrap — pull request #607 by khalilravanna (2013-07-01 18:33:44+00:00)
Title: Typeahead: Fixed waitTime functionality

A fix for bug #573.

This pull request fixes the bug where `$timeout` calls were not cancelled even if they occurred in the time period defined by `waitTime`.

The reason for the bug was that `timeoutId` was declared inside the scope of the function being pushed to `$parsers`, and therefore could not be referenced outside of the anonymous function. By declaring the `timeoutId`, now renamed `timeoutPromise` (because the return of `$timeout` is not an id but actually a promise) above this function, the offending old `$timeout` calls can be killed.