我尝试使用typehead进行角度自动完成,但它无效。
我从angularstrap页面下载了typehead.js。
的javascript:
var obj = MyClass2("Swift.mov")
print(obj.purposeOfClass) // You will get exception at this point, because the constructor returned Parent's class object.
HTML:
myApp.controller('myCtrl', ['$scope', 'myservice', function ($scope, myservice) {
$scope.counter = 0;
$scope.name= [];
myservice.getData().then(function (msg) {
$scope.name= msg.data.names;
});
$scope.input = "";
}]);
我做错了什么?
如果对自动完成示例有更好的解决方案请告诉我。 thx提前
答案 0 :(得分:4)
如果您希望$scope.name
能够使用$scope.names
中使用的表达式,则bs-options
应为myApp.controller('myCtrl', ['$scope', 'myservice', function ($scope, myservice) {
$scope.counter = 0;
$scope.names= [];
myservice.getData().then(function (msg) {
$scope.names= msg.data.names;
});
$scope.input = "";
}]);
。例如
master
我已经使用上面的修复程序创建了example plunker to show your code working。