x-editable表单,带有typeahead

时间:2016-07-27 16:22:10

标签: angularjs typeahead

你好我对Angular的X-editable相当新。我试图在可编辑的表单中实现一个预先输入或自动完成框。我该如何完成它?

这是我的代码。

  <tbody>
        <tr ng-repeat="equipment in equipments | filter:filterEquipment">
                                    <td width="auto"><span editable-select="equipment.VendorID" e-ng-="selectedVendor" e-form="tableform" e-ng-change="GetItems($data)" e-ng-options="s.ID as s.Name for s in VendorsList">{{showVendors(equipment)}}</span></td>
                                    <td><span editable-text="equipment.ItemID" e-form="tableform" e-typeahead="s.ItemID as s.Name for s in ItemsList">{{showItems(equipment)}}</span></td>
                                    <td><span editable-text="equipment.quantity" e-form="tableform"> {{ equipment.quantity|| 'empty' }}</span></td>
                                    <td><span editable-text="equipment.Cost" e-form="tableform"> {{ equipment.Cost || 'empty' }}</span></td>
                                    <td><span editable-text="equipment.SerialNumber" e-form="tableform"> {{ equipment.SerialNumber || 'empty' }}</span></td>
                                    <td><span editable-text="equipment.Status" e-form="tableform"> {{ equipment.Status || 'empty' }}</span></td>
                                    <td ng-hide="" style="width:20px;"><button type="button" ng-click="deleteEquipment(equipment.id)" class="btn btn-danger pull-right">Delete</button></td>
                                </tr>
                            </tbody>

我希望在第二个<td>

上输入Typeahead

1 个答案:

答案 0 :(得分:0)

<td><span id="itemID" editable-text="equipment.ItemID" e-form="tableform" e-typeahead="s.ItemID as s.Name for s in ItemsList">{{showItems(equipment)}}</span></td>

> //turn to inline mode
> 
> $.fn.editable.defaults.mode = 'inline';

将editable()方法应用于这些元素

$(document).ready(function() {
    $('#itemID').editable();
});