我有一小段代码可以对 3rd 方 API 进行查询。是这个吗:
angular.module('myApp', ['ngResource'])
function Hello($scope, $http) {
$http.get('http://api.discogs.com/database/search?type=artist&q=alva-noto&page=1&per_page=200').
success(function(data3) {
$scope.results = data3.results;
});
};
在 html 方面,现在我只是在 li 上显示一个带有 ng-repeat 的 UL,基于一个特定的搜索。像这样:
<h1>Search</h1>
<ul>
<li ng-repeat="result in results">{{result.title}}</li>
</ul>
我的问题是,如何创建一个输入字段,将里面的文本与搜索查询绑定?就像将字符串引入 ?=string 一样:
$http.get('http://api.discogs.com/database/search?type=artist&q=string&page=1&per_page=200')
有什么想法吗?
谢谢!埃里克