This file contains hidden or 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
| // npm install socket.io-client --save | |
| import * as io from 'socket.io-client'; | |
| socket:any | |
| chat_input:string; | |
| chats = []; | |
| constructor(public navCtrl: NavController) { | |
| this.socket = io('http://localhost:3000'); |
This file contains hidden or 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
| //npm install socket.io --save | |
| // socket.js | |
| var socket = require('socket.io'), | |
| http = require('http'), | |
| server = http.createServer(), | |
| socket = socket.listen(server); | |
| socket.on('connection', function(connection) { | |
| console.log('User Connected'); |
This file contains hidden or 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
| // npm install dateformat | |
| // var dateformat = require('dateformat') | |
| fechaPago = new Date(fechaPago.getUTCFullYear(), | |
| fechaPago.getUTCMonth(), | |
| fechaPago.getUTCDate(), | |
| fechaPago.getUTCHours(), | |
| fechaPago.getUTCMinutes(), | |
| fechaPago.getUTCSeconds()); |
This file contains hidden or 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
| parseInt("10") |
This file contains hidden or 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
| .ajustarTexto{ | |
| word-break: break-all; | |
| white-space: normal; | |
| } |
This file contains hidden or 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
| import { DatePipe } from '@angular/common'; | |
| let datePipe = new DatePipe('es-AR'); | |
| this.miFecha = datePipe.transform(this.miFecha, 'dd/MM/yyyy'); |
This file contains hidden or 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
| primeraLetraMayuscula( str ) | |
| { | |
| let pieces = str.split(" "); | |
| for ( let i = 0; i < pieces.length; i++ ) | |
| { | |
| let j = pieces[i].charAt(0).toUpperCase(); | |
| pieces[i] = j + pieces[i].substr(1).toLowerCase(); | |
| } | |
| return pieces.join(" "); | |
| } |
This file contains hidden or 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
| import { Component,ViewChild } from '@angular/core'; | |
| import { NavController } from 'ionic-angular'; | |
| @Component({ | |
| selector: 'page-home', | |
| templateUrl: 'home.html' | |
| }) | |
| export class HomePage { | |
| @ViewChild('myCanvas') canvas: any; |
This file contains hidden or 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
| import { ViewChild } from '@angular/core'; | |
| @ViewChild('myCanvas') canvas: any; | |
| canvasElement: any; | |
| ctx:any; | |
| ngAfterViewInit(){ | |
| this.canvasElement = this.canvas.nativeElement; | |
| this.ctx = this.canvasElement.getContext('2d'); |
This file contains hidden or 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
| import { ViewChild } from '@angular/core'; | |
| @ViewChild('idDelElemento') imagen: any; | |
| imagenHTML: any; | |
| //costructor | |
| this.imagenHTML = this.imagen.nativeElement; | |
| //ya puedo trabajar, por ejmeplo obteniendo el alto del contenedor | |
| this.imagenHTML.height |
NewerOlder