作者:wang-zhiwen | 来源:互联网 | 2023-05-26 13:09
我有一个文本框,我想在其上应用自动完成.我使用以下插件:
autocomp
它运行正常,但只要我将它与AngularJS结合起来就会停止工作:
我有以下代码:
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;
}
}
和jfiddle链接如下:
jfiddle
正如您所看到的,自动完成功能不起作用,但如果没有Angular,它可以正常工作.
有人可以帮忙吗?
1> squiroid..:
Tags:
你的傻瓜
http://plnkr.co/edit/5XmPfQ78vRjSrxE0Tt3B?p=preview
对不起,我不擅长小提琴.