bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

typeahead does not reset 'editable' flag when ng-model is changed from controller

Open BlackZork opened this issue 11 years ago • 4 comments

I have typeahead input field with typeahead-editable='false'.

To reset validty after changing ng-model from controller I have to call

$scope.myForm.myField.$setValidity('editable', true);

It should be called by directive somewhere in function pushed to modelCtrl.$formatters

BlackZork avatar Dec 19 '14 12:12 BlackZork

+1

I believe I am hitting the same issue, setting Pristine on the form doesn't remove the validation errors, for "typeahead-editable='false'" inputs. Maybe a 1.3 angular issue had to do the same hack of $setValidity manually, all other controls work just fine with pristine:

            if($scope.myForm.$error.editable){
                    var typeaheadErrors = [].concat($scope.myForm.$error.editable);
                    angular.forEach(typeaheadErrors, function(control, key){
                       control.$setValidity('editable', true)     
                    });
            }
            $scope.myForm.$setPristine();

acgentry avatar Jan 06 '15 15:01 acgentry

@zorkus Can you setup a plunkr reproducing your problem? And have you tried if the master branch has this issue fixed?

rvanbaalen avatar Apr 08 '15 16:04 rvanbaalen

I am not able to reproduce this based on current master here.

Closing as resolved. Feel free to open a new issue with a reproduction if this is still an issue.

wesleycho avatar Aug 16 '15 18:08 wesleycho

Just a note to say I can see this was a bug in 1.3.8 and is now fixed in 1.4.3.

http://plnkr.co/edit/GX5lF5

All is well.

Squiggle avatar Aug 17 '15 14:08 Squiggle