是否可以使用ng-tags-input
创建自定义自动播放功能?
我在服务器上有这样的回复:
这是我获取国家和地址自动播放的方式:
search.data.suggest.country[0].options
这个回溯对象数组:
[
{"text": "Puerto Rico", "score" : "1"}
...
]
search.data.adress.country[0].options
这是我的尝试只是因为没有工作的... ...
$http.get('http://localhost:3000/api/v1/gym/autocompletion?q=' + query)
.then(function(search) {
var deferred = $q.defer();
console.log(search.data.suggest.country[0].options);
deferred.resolve(search.data.suggest.country[0].options);
return deferred.promise;
});
这将显示错误:
angular.js:13550 TypeError: Cannot read property 'data' of undefined
at ng-tags-input.min.js:1
at processQueue (angular.js:15961)
at angular.js:15977
at Scope.$eval (angular.js:17229)
at Scope.$digest (angular.js:17045)
at Scope.$apply (angular.js:17337)
at angular.js:19166
at completeOutstandingRequest (angular.js:5869)
at angular.js:6145
对此有何解决方案?