UI Bootstrap Typahead异步在AngularJS RC2中不起作用

时间:2013-09-18 21:38:30

标签: javascript twitter-bootstrap angularjs angularjs-directive angular-ui-bootstrap

为什么在使用$ http服务从服务器检索匹配时,UI Bootstrap Typahead在AngularJS RC2中不起作用?这在AngularJS RC1中起作用

请参阅this plunker using RC1this using RC2 (输入至少3个字母进行测试,例如'bos')

编辑:

我不确定这是AngularJS问题还是UI Bootstrap问题

错误:

TypeError: Cannot read property 'length' of undefined
at http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.6.0.js:3086:24
at wrappedCallback (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular.js:9106:81)
at wrappedCallback (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular.js:9106:81)
at http://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular.js:9192:26
at Scope.$eval (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular.js:10034:28)
at Scope.$digest (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular.js:9882:23)
at Scope.$apply (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular.js:10137:24)
at HTMLInputElement.listener (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular.js:13808:13)
at http://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular.js:2277:10
at Array.forEach (native) 

1 个答案:

答案 0 :(得分:0)

Angular 1.2.0-RC2有一个已知的回归,禁止$parse()服务返回一个promise。这意味着您的$http()请求的结果将始终被删除(因此返回undefined)。

this commit comment了解详情。