Angularjs 动态文本框的自动完成功能

Angularjs 动态文本框的自动完成功能,angularjs,autocomplete,dynamic-text,Angularjs,Autocomplete,Dynamic Text,我有一个动态创建的文本框列表。在第一个文本框中,我将给出产品名称。然后,其他文本框应自动填充相关值。当我们开始输入产品名称时,它应该在下拉列表中给出适当的建议。 我试图在这里实现自动完成功能。 有人能指导我如何实现自动完成功能吗? 我还想知道如何获取所有文本框的值 HTML代码: <table class="data-table"> <tr> <th>Pro

我有一个动态创建的文本框列表。在第一个文本框中,我将给出产品名称。然后,其他文本框应自动填充相关值。当我们开始输入产品名称时,它应该在下拉列表中给出适当的建议。 我试图在这里实现自动完成功能。 有人能指导我如何实现自动完成功能吗? 我还想知道如何获取所有文本框的值

HTML代码:

<table class="data-table">
                        <tr>
                            <th>Product/Service</th>
                            <th>Description</th>
                            <th>Unit Price</th>
                            <th>Quantity</th>
                            <th>Discount</th>
                            <th>Total Price</th>
                        </tr>
                        <tr></tr>

                        <tr ng-repeat="Product in Products">
                            <td><input type="text" ng-model="Product.ProductName" aria-labelledby="select_{{$index}}"  onkeypress="addProducts()" /></td>
                            <td><input type="text" ng-model="Product.ProductDesc" aria-labelledby="select_{{$index}}" /></td>
                            <td><input type="text" ng-model="Product.UnitRate" aria-labelledby="select_{{$index}}" /></td>
                            <td><input type="text" ng-model="Product.Quantity" aria-labelledby="select_{{$index}}" /></td>
                            <td><input type="text" ng-model="Product.Discount" aria-labelledby="select_{{$index}}" /></td>
                            <td><input type="text" ng-model="Product.TotalAmount" aria-labelledby="select_{{$index}}" /></td>
                            <td><button ng-click="removeProduct(Product)">X</button></td>
                        </tr>
                        <tr>
                            <td><button ng-click="addProducts()">Add Products</button></td>
                        </tr>
</table>

通过在textbox上定义自定义指令,使用jquery自动完成方法

看看这个-


通过在textbox上定义自定义指令,使用jquery自动完成方法

看看这个-

  $scope.Products = [
     { ProductName: '', ProductDesc: '', UnitRate: '' ,Quantity: '' ,Discount: '' }
];

$scope.removeProduct = function (ProductToRemove) {
    var index = $scope.Products.indexOf(ProductToRemove);

    $scope.Products.splice(index, 1);
};

$scope.addProducts = function () {
    $scope.Products.push({ ProductName: '', ProductDesc: '', UnitRate: '', Quantity: '', Discount: '' });
};