I have a situation I am new to angularjs, I have to load a table of 16000 records in a select, but I know it is too much to show in a select someone has a suggestion? I have to deliver it soon u.u
my html code with the init I bring the 16000 records but I have no idea how to load them since one of them must be selected: S help
<div class="form-group" ng-init="GetArticulos()">
<label>Sku Final</label>
<br />
<input type="search"class="form-control" placeholder="Coloca el codigo de producto" ng-model="searchtext"/>
<select ng-model="articuloseleccionado" class="form-control" data-content="Seleccione un articulo" placeholder="Seleccione un articulo">
<option value="" disabled selected>Seleccione un Articulo</option>
<option ng-repeat="articulo in articulos | filter:searchtext" value="">{{tamano.ListaProductos}}</option>
</select>
</div>
Angularjs code
controller
$scope.articulos = {};
$scope.GetArticulos = function () {
console.log("Entrando al controlador GetPrecios")
ArticulosService.GetArticulos()
.then(function (response) {
if (response.code = 100) {
$scope.articulos = response.data.Result;
//$scope.tamanos = angular.toJson(response.data.Result);
$scope.apply;
console.log($scope.articulos);
}
}, function (err) { });
}
Angular service
'use strict'
app.service('ArticulosService', ['$http', '$q', function ($http, $q) {
this.GetArticulos = function () {
var defered = $q.defer();
console.log("Entrando al Servicio TipoEtiqueta")
$http({
method: 'GET',
url: 'Labels/ObtenerArticulos',
// dataType:'json',
//params:{Itemcode:itemcode}
})
.then(function (response) {
defered.resolve(response);
},
function (err) {
defered.reject(err);
});
return defered.promise;
}
}]);
Class c
[HttpGet]
public JsonResult ObtenerArticulos()
{
CentralPOSDataManager Code = new CentralPOSDataManager();
var result = Code.Busqueda_Articulos();
return Json(result, JsonRequestBehavior.AllowGet);
}
function c
public MethodResponse<List<Articulos>> Busqueda_Articulos()
{
MethodResponse<List<Articulos>> Result = new MethodResponse<List<Articulos>>() { Code = 100, Message = "", Result = new List<Articulos>() };
try
{
using (CNTEntities db = new CNTEntities())
{
try
{
string query = "EXEC Busqueda_Articulos";
var res = db.Database.SqlQuery<Articulos>(query).ToList();
if (res.Count > 0)
{
Result.Result = res;
}
else
{
Result.Message = "No encontro registro";
}
}
catch (Exception ex)
{
Result.Message = ex.Message + "QUERY DE ETIQUETAS";
}
}
}
catch (Exception ex)
{
Result.Message = ex.Message + "METODO RESPONDE DE ETIQUETAS";
}
return Result;
}
Store SQL
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Busqueda_Articulos]
as
begin
SELECT ItemCode + ' ' + ItemName AS ListaProductos
FROM OITM WITH(NOLOCK)
ORDER BY ItemCode ASC;
end
someone to help me?