1
votes

I have a textbox for which i suggest cities. I have used angualar-ui typeahead for suggestions. Now everything seems to be working fine.

Just that when i reset form through angular using $scope.cancel it does not reflect on UI and also the model does not seem to be reset to correct value since the form seems to be dirty. For fields that are not having typeahead works just fine.

Anyone came across this?

Code:

<input placeholder='City' type="text" ng-model="form.city" typeahead="x for x in suggestCity($viewValue)" />

function ContactController($scope, $http) {
    $scope.cancel = function() {
        $scope.form = angular.copy($scope.userprofile.contact);
    }
}

http://plnkr.co/edit/JuIuAXZQVsJlEzjM0faT?p=preview

1
could you share your complete html or fiddle code please - Ajay Beniwal
edited question to add plnkr code - Srinivas

1 Answers

0
votes

OK, so there was a bug fixed in the 0.4.0 version of http://angular-ui.github.io/bootstrap/

The change done in https://github.com/angular-ui/bootstrap/issues/591 fixes your issue as well. It wasn't released yet but here is the working plunk with the version from continuous integration server:

http://plnkr.co/edit/17UOgHJd82otwC6TS7s9?p=preview