我正在尝试 angularjs 自动完成 Angucomplete Alt在这里,我复制了相同的代码并在本地主机上运行,但这没有显示任何结果
我正在搜索术语 ssss 它显示错误
获取 https://api.github.com/search/repositoriessafa 404(未找到)
我的代码是
var myApp = angular.module('myApp', ["angucomplete-alt"]);
myApp.controller('TestController', function ($scope, $http) {
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angucomplete-alt/3.0.0/angucomplete-alt.min.js"></script>
<body ng-app="myApp" ng-controller="TestController">
<div angucomplete-alt
id="ex5"
placeholder="Search projects"
pause="500"
selected-object="selectedProject"
remote-url="https://api.github.com/search/repositories"
remote-url-request-formatter="remoteUrlRequestFn"
remote-url-data-field="items"
title-field="name"
description-field="description"
minlength="2"
input-class="form-control form-control-small"
match-class="highlight">
</div>
</body>
有什么遗漏吗?
最佳答案
如果您打开开发工具,您可以看到远程调用未以正确的方式进行。
您必须添加查询字符串
尝试在此编辑您的远程网址
remote-url="https://api.github.com/search/repositories?q="
它会起作用
关于javascript - 远程自动完成功能不起作用 Angucomplete Alt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53553303/