Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

1.3.0-beta11 and ngIf broke angular-ui-bootstrap's typeahead #8072

Closed
@wuzzeb

Description

@wuzzeb

Not sure if this is a bug in angular or angular-ui/bootstrap, but I manually bisected this where 1.3.0-beta10 works and 1.3.0-beta11 fails so I am reporting this here.

http://plnkr.co/edit/RykkeZqMnyHXLbPfciV9 shows the bad behavior. Change to beta10 and you can see it work. What happens for me with beta11+ is if you type something into the typeahead and then click on one of the states that pop up, the state is not selected.

I debugged it to the following:

In https://github.com/angular-ui/bootstrap/blob/master/template/typeahead/typeahead-popup.html the ul tag uses ng-if directive to decide to show the dropdown or not. What happens in beta11+ is that the scope for the typeahead-popup directive (located https://github.com/angular-ui/bootstrap/blob/master/src/typeahead/typeahead.js#L327) is not rebound to the ul element when the popup is opened. Therefore, the ng-click directive on the embedded li element does nothing, i.e. it should call scope.selectMatch but since the scope has not been rebound correctly the function is not called. Next the click event is propogated and eventually the typeahead directive click handler (https://github.com/angular-ui/bootstrap/blob/master/src/typeahead/typeahead.js#L303) is run to close the popup.

If I change the ng-if directive on the ul tag to ng-show then the typeahead works (tested with beta14) since the li element now has the right scope so the call to selectMatch works. This leads me to believe that d71df9f is the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions