借口
network中拉到底找到su?cb=jquery即可;?之前的就是借口,后面是参数
<!DOCTYPE html>
<html ng-app='test'>
<head>
<meta charset="utf-8">
<title>angular</title>
<meta name="viewport" content="width=device-width,initial-scale=1.0,
maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
<link rel="stylesheet" type="text/css" href="static/css/reset.css">
<script src="js/angular1.58.js" charset="utf-8"></script>
<script >
var app=angular.module('test',[])
app.controller('zhangsan',function($scope,$http){
$scope.a=''
$scope.arr=[]
$scope.$watch('a',()=>{
$http.jsonp('https://gsp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su',{params:{wd:$scope.a,cb:'JSON_CALLBACK'}}).success((res)=>{
console.log(res)
$scope.arr=res.s
}).error(()=>{
console.log('获取数据失败')
});
})
})
</script>
</head>
<body ng-controller='zhangsan'>
<input type="text" ng-model='a' name="" value="">
<ul>
<li ng-repeat='v in arr'>{{v}}</li>
</ul>
</body>
</html>