1

我创建了一个智能表并结合了预输入功能:

  <input type="text" class="form-control" ng-click="selectPerson()" ng-model="selectedPerson"
           bs-options="person.firstName for person in rowCollection" placeholder="Search for person" bs-typeahead>

    <table st-table="displayedCollection" st-safe-src="rowCollection" class="table table-striped">
        <thead>
        <tr>
            <th st-sort="firstName">first name</th>
            <th st-sort="lastName">last name</th>
            <th st-sort="birthDate">birth date</th>
            <th st-sort="balance">balance</th>
        </tr>

        </thead>
        <tbody>
        <tr ng-repeat="row in displayedCollection">
            <td>{{row.firstName}}</td>
            <td>{{row.lastName}}</td>
            <td>{{row.birthDate}}</td>
            <td>{{row.balance}}</td>
            <td>
                <button type="button" ng-click="removeItem(row)" class="btn btn-sm btn-danger">
                    <i class="glyphicon glyphicon-remove-circle">
                    </i>
                </button>
            </td>
        </tr>
        </tbody>
    </table>

目标是在搜索输入的表格中搜索一个人,选择姓名,然后显示在其下方的智能表格中。当我选择一个人时,这会触发:

$scope.selectPerson = function(){
    $scope.displayedCollection = $scope.selectedPerson;
    console.log($scope.displayedCollection );
}

但是,它不会显示表格中的人。我该如何修复它以显示该人?

plunkr:http ://plnkr.co/edit/NXEbl5?p=preview

4

0 回答 0