您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

$http实现百度搜索动态下拉框

2026/2/14 10:03:31发布23次查看
本文主要和大家分享angularjs-$http实现百度搜索时的动态下拉框示例,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧,希望能帮助到大家。
实例如下所示:
<!doctype html> <html ng-app="myapp">   <head>    <meta charset="utf-8">    <title></title>    <style type="text/css">      p{       overflow: hidden;       margin-top: 50px;       margin-left: 500px;      }      .container{       width: 250px;       padding: 0;      }      .container li{       list-style: none;       border: 1px dotted gray;       width: inherit;      }    </style>   </head>   <body>    <p ng-controller="myctrl">      <input type="text" ng-model="name" placeholder="请输入内容..." ng-keyup="change(name)"/>      <input type="button" name="" id="" value="搜索" ng-click="change(name)"/>      <ul class="container">       <li ng-repeat=" d in mes">{{d}}</li>      </ul>    </p>   </body>   <script src="angular.min.js"></script>   <script src="angular-route.min.js"></script>   <script src="angular-ui-router.min.js"></script>   <script type="text/javascript">    var app = angular.module(myapp,[]);    app.controller(myctrl,function($scope,$http,$timeout){      $scope.mes = [] ;      var timer = null ;      $scope.change = function(name){       $timeout.cancel(timer);       timer = $timeout(function(){                $http({         method:jsonp,         url:https://sp0.baidu.com/5a1fazu8aa54nxgko9wtanf6hhy/su?wd=+name+&json=1&p=3&sid=&req=2&csor=8&cb=json_callback         })         .success(function(data){          $scope.mes = data.s;          console.log(data.s);         })       },500)                  }    })   </script> </html>
相关推荐:
angularjs利用$http异步上传excel文件方法分享
angularjs中$http服务内容
angularjs实现$http.post和$http.get请求的代码详解
以上就是$http实现百度搜索动态下拉框的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product