【问题标题】:Remote autocomplete is not working Angucomplete Alt远程自动完成功能不起作用 Angucomplete Alt
【发布时间】:2018-11-30 16:38:08
【问题描述】:

我正在尝试 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>

有什么遗漏吗?

【问题讨论】:

    标签: javascript angularjs


    【解决方案1】:

    如果您打开您的开发工具,您会发现远程调用的方式不正确。

    您必须添加查询字符串

    尝试在此编辑您的远程网址

    remote-url="https://api.github.com/search/repositories?q="
    

    它会起作用的

    【讨论】:

      猜你喜欢
      • 2016-09-13
      • 2012-09-09
      • 1970-01-01
      • 2015-08-18
      • 2017-02-28
      • 2020-11-14
      • 2014-03-11
      • 2014-01-16
      • 2011-03-14
      相关资源
      最近更新 更多