I have a text box and I want to apply the autocomplete on it. I am using the following plugin:
autocomp
and it works fine but as soon as I combine it with AngularJS it stops working:
I have the following code:
function personController($scope) {
$scope.firstName = "John",
$scope.lastName = "Doe",
$scope.availableTags = [],
$scope.fullName = function() {
/* return $scope.firstName + " " + $scope.lastName;*/
$scope.availableTags= [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
$(document).ajaxComplete(function(){
alert('');
$("#txt").autocomplete({
source: $scope.availableTags,
});
});
//return $scope.availableTags;
}
}
and jfiddle link is as follow:
jfiddle
As you can see the autocomplete does not work, though without Angular it works well.
Can anyone help?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…