JSFiddle - React, Tailwind, and code Playground
by Esteban Lopez
HTML
<script src="http://code.angularjs.org/1.2.0-rc.3/angular.js"></script>
<div ng-controller="MyCtrl">
<form class="buscadorForm">
<input placeholder="PALABRA CLAVE" type="text" ng-model="filtros.name" ng-change="changeCurrentPage(0);" />
<input placeholder="CODIGO PRODUCTO" type="text" ng-model="filtros.codigoProducto" ng-change="changeCurrentPage(0);"/>
<select ng-model="filtros.subCategoryId" ng-change="changeCurrentPage(0)">
<option value="">TODOS</option>
<option ng-repeat="subct in subCategoriaActual" value="{{subct.id}}">{{subct.name}} - id {{subct.id}}</option>
</select>
</form>
<div id="dContainerAllProductos">
<ul class="listaProductos clearfix" >
<li ng-animate="'animate'" ng-repeat="prod in objtemp.products | orderBy:'ordenProducto' | filter:filtros | startFrom:currentPage*pageSize:this | limitTo:pageSize" ng-class='{marginLeftNone: $index%4==0}' >
<a href="javascript:void(0)"> <span>{{ prod.name }}</span>
Cod.{{ prod.codigoProducto }}
</a> catId {{prod.subCategoryId}}
</li>
</ul>
<div class="paginadorProductos clearfix" ng-show="objtemp.products.length > 0">
<button class="prevPaginador" ng-disabled="currentPage == 0" ng-click="changeCurrentPage(currentPage-1)" ><<</button>
<ul>
<li ng-repeat="i in filtered = (getFilteredNumber( (objtemp.products | filter:filtros ).length)) track by $index" ng-class='{selected: $index == currentPage}' >
<a href="javascript:void(0)" ng-click="changeCurrentPage($index)">{{$index+1}} </a>
</li>
</ul>
<button class="nextPaginador" ng-disabled="currentPage >= ( objtemp.products | filter:filtros ).length/pageSize - 1" ng-click="changeCurrentPage(currentPage+1)" > >></button>
</div>
</div>
</div>
JavaScript
var myApp = angular.module('myApp',[]);
function MyCtrl($scope) {
$scope.objtemp = {};
$scope.filtered = new Array();
$scope.filtro = 0;
$scope.currentPage = 0;
$scope.pageSize = 16;
$scope.Math = window.Math;
$scope.subCategoriaActual =[
{
"id": 1,
"name": "BASUREROS",
"description": "BASUREROS",
"categoryId": 4,
"createdAt": null,
"updatedAt": null
},
{
"id": 2,
"name": "DESECHABLES",
"description": "DESECHABLES",
"categoryId": 4,
"createdAt": null,
"updatedAt": null
},
{
"id": 3,
"name": "INFANTIL",
"description": "INFANTIL",
"categoryId": 4,
"createdAt": null,
"updatedAt": null
},
{
"id": 4,
"name": "GENERAL",
"description": "Sub Categoria General",
"categoryId": 4,
"createdAt": {
"date": "2008-12-23 13:11:25",
"timezone_type": 3,
"timezone": "UTC"
},
"updatedAt": {
"date": "2008-12-23 13:11:31",
"timezone_type": 3,
"timezone": "UTC"
}
},
{
"id": 12,
"name": "COCINA",
"description": "COCINA",
"categoryId": 4,
"createdAt": null,
"updatedAt": null
}
];
$scope.currentPage = 0;
$scope.objtemp.products = [
{
"id": 7931,
"description": "Cepillo de pila",
"name": "Cepillo de pila",
"dimention": "Largo 15 cm, Ancho 6 cm, Alto 7 cm. ",
"volume": "0.00",
"capacity": "0.00",
"model": "7001582100",
"tags": "",
"createdAt": {
"date": "2008-10-28 18:28:55",
"timezone_type": 3,
"timezone": "America\/Costa_Rica"
},
"updatedAt": {
"date": "2013-02-15 14:29:40",
"timezone_type": 3,
"timezone":...