angucomplete icon indicating copy to clipboard operation
angucomplete copied to clipboard

initialize textbox value

Open mthompson opened this issue 10 years ago • 7 comments

Is it possible to set the input textbox value. Example... you load a view with data from a service call that populates the view on initial page load and you need to set the value of the lookup textbox initially.

Is this already possible. If so, how?

mthompson avatar Mar 31 '14 23:03 mthompson

i have same problem, is this already possible to innitialize the textbox value?

endytc avatar May 24 '14 09:05 endytc

yeah.. have the same question i have solved this by adding

"model":"=?ngModel" 
$scope.$watch('model', function (value) {
                        if (angular.isUndefined(value)) {
                            return;
                        }
                        if (value === null) {
                            $scope.searchStr = '';
                        } else {
                            if (!angular.equals($scope.searchStr, value)) {
                                // $scope.searchTimerComplete(value);
                                $scope.searchStr = value;
                            }
                        }
                    });

Its allow 'clear' and 'fill' field, but its listening ng-model from directive-tag, so you need add it. also you can remove '//' if you need run search.

OleksandrPopov-San4o avatar Jun 07 '14 15:06 OleksandrPopov-San4o

any updates about this?

foozee avatar Aug 06 '14 14:08 foozee

:+1: have same issue

inalgnu avatar Aug 28 '14 10:08 inalgnu

+1

bjackson avatar Sep 23 '14 02:09 bjackson

Try angucomplete-alt http://ghiden.github.io/angucomplete-alt/#example9

ghiden avatar Sep 23 '14 08:09 ghiden

Vincent l'a fait: Broadcast the event and watch it : In your angucomplete.js, add : ```

  $scope.$on('clearInput', function () {
            	 $scope.searchStr = null;
            })

Then , in your controller,
`$scope.$broadcast('clearInput');`

salemba avatar Mar 27 '17 16:03 salemba