import { HTTP_INTERCEPTORS } from ‘@angular/common/http’; import { AuthInterceptor } from ‘./auth-interceptor’; @NgModule({ // … providers: [ { provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true } ] }) export class AppModule… [Continuar Leyendo]
Archivos: Code Snippets
import { Injectable } from ‘@angular/core’; import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent } from ‘@angular/common/http’; import { Observable } from ‘rxjs’; @Injectable() export class AuthInterceptor implements HttpInterceptor { intercept(req: HttpRequest<any>,… [Continuar Leyendo]
<form [formGroup]="form" (ngSubmit)="onSubmit()"> <!– … –> </form>
export class MyFormComponent { form: FormGroup; constructor() { this.form = new FormGroup({ name: new FormControl(»), email: new FormControl(»), message: new FormControl(») }); } onSubmit() { // aquí puede acceder a… [Continuar Leyendo]
<form [formGroup]="form"> <label> Nombre: <input type="text" formControlName="name"> </label> <br> <label> Email: <input type="email" formControlName="email"> </label> <br> <label> Mensaje: <textarea formControlName="message"></textarea> </label> <br> <button type="submit">Enviar</button> </form>
angular formulario reactivo ts
Generador de autobots con solidity y factory, usando el ide Remix
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; contract Pokemon { // Cualidades para cada pokemon struct cualidades { string name; string tipo_pokemon; string ataque; } // Listado de pokemon que tenemos… [Continuar Leyendo]
const array = [1, 2, 3, 4, 5]; const even = (element) => element % 2 === 0; const result = array.some(even) ? ‘primero’: ‘segundo’; console.log(result); // expected output: primero
Utilización del método some de javascript, modificando el array