Added support for initializing typeahead inside promises