我已使用以下代码使用>>> import filters
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "E:\anaconda3\lib\site-packages\filters\__init__.py", line 27, in <modu
from filters.extensions import FilterExtensionRegistry
File "E:\anaconda3\lib\site-packages\filters\extensions.py", line 11, in <mo
from class_registry import EntryPointClassRegistry
File "E:\anaconda3\lib\site-packages\class_registry\__init__.py", line 5, in
from .registry import *
File "E:\anaconda3\lib\site-packages\class_registry\registry.py", line 33, i
class BaseRegistry(with_metaclass(ABCMeta, Mapping)):
File "E:\anaconda3\lib\site-packages\six.py", line 827, in __new__
return meta(name, bases, d)
File "E:\anaconda3\lib\abc.py", line 126, in __new__
cls = super().__new__(mcls, name, bases, namespace, **kwargs)
TypeError: type() doesn't support MRO entry resolution; use types.new_class()
填充自动完成功能。我可以在按下键盘的同时调用API,但无法使用map函数匹配结果。
ui.bootstrap
angular.module('ui.bootstrap.demo', ['ui.bootstrap']);
angular.module('ui.bootstrap.demo').controller('TypeaheadCtrl', function($scope, $http) {
var _selected;
$scope.selected = undefined;
$scope.states = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico', 'New York', 'North Dakota', 'North Carolina', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island', 'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming'];
// Any function returning a promise object can be used to load values asynchronously
$scope.getCategories = function(val) {
return $http.get('http://localhost/projects/food-court/merchant/category', {
params: {
category_name: val
}
}).then(function(response) {
return response.data.results.map(item => {
console.log('test');
//return item.id;
});
//console.log(tt)
});
};
});