angucomplete
angucomplete copied to clipboard
initialize textbox value
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?
i have same problem, is this already possible to innitialize the textbox value?
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.
any updates about this?
:+1: have same issue
+1
Try angucomplete-alt http://ghiden.github.io/angucomplete-alt/#example9
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');`