I am working an a project and had to make a product list. but when I use select2 with the search option the value doesn't change and if I add a new row, I get a none select2 field. Could some help me out please? Or if you have other options to get the some result that would really Grateful. Sorry for my bad English.
$(document).ready(function() {
$(".js-example-basic-single").select2();
});
var invoice = angular.module("invoice", []);
invoice.controller("InvoiceController", function($scope) {
$scope.invoice = {
items: [
{
name: "item",
description: "item description",
qty: 5,
price: 5.5
}
]
};
($scope.add = function() {
$scope.invoice.items.push({
name: "",
description: "",
qty: 1,
price: 0
});
}),
($scope.remove = function(index) {
$scope.invoice.items.splice(index, 1);
}),
($scope.total = function() {
var total = 0;
angular.forEach($scope.invoice.items, function(item) {
total += item.qty * item.price;
});
return total;
});
});
See the CodePen: