This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dateToSeconds(date) { | |
const dateTime = new Date(date); | |
return dateTime.getTime() / 1000; | |
} | |
function getDateMocked() { | |
const date = new Date(); | |
date.setHours(17); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public update = (dataID): any => { | |
var deferred = this.$q.defer(); | |
//var promise = deferred.promise; | |
this.services.getDataById(dataID) | |
.then((data) => { | |
deferred.resolve(data); // En caso de ser exitoso retornamos data (falta catch) | |
}); | |
// En caso de solo querer retornar un "exito" | |
deferred.resolve(); | |
return deferred.promise; // Retornamos el objeto promesa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getDateFromEpoch(timeEpoch) { | |
// date = dd/mm/yyyy, hh:mm. | |
var date = new Date(timeEpoch).toLocaleString("en-GB").toString(); | |
// with substr the return = dd/mm/yyyy | |
return date.substr(0, fecha.indexOf(",")); | |
} | |
/* | |
Documentation about toLocaleString(): https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports = module.exports = function(app, conf) { //BASE DEL BACKEND | |
app.get('/api/orm-txt/download', function(req, res){ // <a href="/api/orm-txt/download" target="_blank">Descargar</a> | |
var text="Hello World!"; | |
res.set({"Content-Disposition":"attachment; filename=\"test.txt\""}); //Se lo crea como un archivo y se le asigna un nombre | |
res.send(text); //Se envia al usuario | |
}); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var filters=["filtro1","filtro2","filtro3","filtro4","filtroN"]; | |
$scope.filtrar=function(object) | |
{ | |
if($scope.filtroTxT.length) | |
{ | |
for (var i = 0; i<filters.length; i++) | |
{ | |
if((object[filters[i]]) && (object[filters[i]]==$scope.filtroTxT))//Revisa cada campo dentro del array y lo busca dentro del objeto. | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input list="browsers"> | |
<datalist id="browsers"> | |
<option data-value="5" value="qwe"> | |
<option data-value="4" value="asd"> | |
<option data-value="3" value="zxc"> | |
<option data-value="2" value="rty"> | |
<option data-value="1" value="fgh"> | |
</datalist> | |
<input list="browsers" name="browser"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.controller('pruebaAppCtrl', function($rootScope){ | |
var self = this; | |
self.otroDato = "Esto está ahora en el scope, para acceder a través de un alias"; | |
//Se lo declara en this, de modo que solo se podra llamar a través de un alias- | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Esta funcion, se encarga de enviar parametros entre controllers de una manera sencilla, | |
el problema es que es global y todos los controllers tienen acceso a estas variables y la mejor manera, | |
es que se llamen mediante invocacion. | |
*/ | |
var app = angular.module("MyApp", []); | |
//Se crea el factory que responde un objeto vacio, despues se le puede agregar contenido desde los controllers. | |
app.factory("MyService", function() { | |
return { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Se pasan parametros entre controllers mediante la URL, esto no puede superar los 1023 caracteres. | |
En el BAG seria el routes.js y en el controller se toma normal. | |
*/ | |
var app = angular.module("MyApp", []); | |
app.config(function($routeProvider) { | |
$routeProvider. | |
when('/view1', { | |
templateUrl: 'view1.html', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Con este CSS pone puntos suspensivos cuando un texto es demasiado grande para su contenedor, el css se le aplica al contendor, | |
para que limite al texto. | |
*/ | |
<style type="text/css"> | |
.contenido { | |
/* | |
width:500px; | |
background-color:orange; | |
color:white; |