借口
network中拉到底找到su起愈?cb=jquery即可只恨;官觅?之前的就是借口阐污,后面是參數(shù)
<!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('獲取數(shù)據(jù)失敗')
});
})
})
</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>