Javascript ngTable中带有提前键入和工具提示的AngularUI,scope.isOpen中未定义自定义标题长度

Javascript ngTable中带有提前键入和工具提示的AngularUI,scope.isOpen中未定义自定义标题长度,javascript,angularjs,angularjs-ng-repeat,angular-ui,ngtable,Javascript,Angularjs,Angularjs Ng Repeat,Angular Ui,Ngtable,我在带有自定义标题的ng表中使用了Typeahead和工具提示。这似乎在功能上起作用,如果你看一下plunker,你永远不会注意到问题。但是,当您运行代码时,它会生成许多错误,这些错误可以在控制台中看到。每当我将鼠标移到其中一行上,或从Typeahead中选择一个值时,都会在加载时生成错误。有人知道如何解决这个问题吗?我已经做了几天了,还没有找到解决办法 这里是错误 TypeError: Cannot read property 'length' of undefined at Scope.sc

我在带有自定义标题的ng表中使用了Typeahead和工具提示。这似乎在功能上起作用,如果你看一下plunker,你永远不会注意到问题。但是,当您运行代码时,它会生成许多错误,这些错误可以在控制台中看到。每当我将鼠标移到其中一行上,或从Typeahead中选择一个值时,都会在加载时生成错误。有人知道如何解决这个问题吗?我已经做了几天了,还没有找到解决办法

这里是错误

TypeError: Cannot read property 'length' of undefined
at Scope.scope.isOpen (http://localhost:61814/app/Scripts/ui-bootstrap-tpls-0.11.0.js:3756:31)
at $parseFunctionCall (http://localhost:61814/app/Scripts/angular.js:11351:18)
at Scope.$eval (http://localhost:61814/app/Scripts/angular.js:13202:28)
at Object.watchExpression (<anonymous>:763:37)
at Scope.$digest (http://localhost:61814/app/Scripts/angular.js:13032:40)
at Scope.$delegate.__proto__.$digest (<anonymous>:844:31)
at Scope.$apply (http://localhost:61814/app/Scripts/angular.js:13306:24)
at Scope.$delegate.__proto__.$apply (<anonymous>:855:30)
at done (http://localhost:61814/app/Scripts/angular.js:8797:47)
at completeRequest (http://localhost:61814/app/Scripts/angular.js:9012:7) 
这是html

<!DOCTYPE html>
<html ng-app="plunker">

<head>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<script>document.write('<base href="' + document.location + '" />');</script>
<link rel="stylesheet" href="style.css" />
<script data-require="angular.js@1.2.x" src="https://code.angularjs.org/1.2.22/angular.js" data-semver="1.2.22"></script>

<script src="ng-table.js"></script>
<script src="app.js"></script>
<script src="ui-bootstrap-tpls-0.11.0.js"></script>
</head>

<body ng-controller="MainCtrl">
<div class="container">
<div class="jumbotron">
<div class="tab-content">
<div class="tab-pane active">
<div>* To clear name filter delete previously entered text and press the Enter key.</div>
<table ng-table="charactersTable" class="table table-hover table-condensed table-striped">
<thead>
  <tr class="main">
    <th class="sort" ng-click="charactersTable.sorting({'Name' : charactersTable.isSortBy('Name', 'asc') ? 'desc' : 'asc'})">Character Name <span class="glyphicon glyphicon-sort"></span></th>
    <th class="sort" ng-click="charactersTable.sorting({'Role' : charactersTable.isSortBy('Role', 'asc') ? 'desc' : 'asc'})">Role <span class="glyphicon glyphicon-sort"></span></th>
  </tr>
  <tr class="filters">
    <th class="input">
    <div class="btn-group">
      <input type="text" class="form-control passive" ng-model="data.selected" 
      typeahead="characterName as character.Name for character in testData | filter:$viewValue | limitTo:8" 
      typeahead-on-select="selectMatch($item)" ng-keypress="clearNameFilterText($event)"
      placeholder="Enter name">
    </div>
    </th>
    <th class="dropdown">
    </th>
  </tr>
</thead>
<tbody>
  <tr ng-repeat="item in $data">
    <td><a ng-click="" class="" tooltip-placement="right" tooltip-popup-delay="500" tooltip-html-unsafe='<div class="tooltip-inner vertical"><table><tr><td>Name</td><td>{{item.Name}}</td></tr><tr><td>Role</td><td>{{item.Role}}</td></tr></table></div>'>{{item.Name}}</a></td>
    <td>{{item.Role}}</td>
  </tr>
  </tbody>
</table>
</div>
</div>
</div>
</div>
</body>

</html>

安古拉斯普朗克
文件。写(“”);
*要清除名称过滤器,请删除以前输入的文本,然后按Enter键。
字符名
角色
但是,您不会在plunker上看到错误。在本地或从web服务器运行代码时会出现错误


提前感谢您对这个问题的帮助。

似乎是
typeahead
中的一个缺陷

解决方法是:-初始化$scope.matches,这是
typeahead
本身应该完成的

  $scope.data = {};
  $scope.data.selected = "";
  $scope.matches = [];//workaround
工作:

  $scope.data = {};
  $scope.data.selected = "";
  $scope.matches = [];//workaround