我正在尝试angularjs自动完成Angucomplete Alt,在这里我复制了相同的代码并在mylocal主机上运行,但这未显示任何结果
我正在搜索SSSS,它显示错误
GET https://api.github.com/search/repositoriessafa 404 (Not Found)
我的代码是
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>
有什么丢失的东西吗?
答案 0 :(得分:1)
如果打开开发工具,您会看到远程调用的方式不正确。
您必须添加查询字符串
尝试以此编辑您的远程URL
remote-url="https://api.github.com/search/repositories?q="
它将起作用