Skip to content

Instantly share code, notes, and snippets.

@fjmduran
Last active May 8, 2021 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fjmduran/4f7319545de92a2172a4a0aa55c1abe0 to your computer and use it in GitHub Desktop.
Save fjmduran/4f7319545de92a2172a4a0aa55c1abe0 to your computer and use it in GitHub Desktop.
Cómo enviar el valor de un input al TypeScript de una forma rápida en Angular, sin necesidad de formularios

Envía rápido el valor de un input al TS

Con el símbolo de numeral (#) identificas al input y así puedes enviar su valor en el ng-click.

<mat-form-field style="max-width: 21rem; width: 100%;" appearance="outline">
        <mat-label>Identificador de comunidad</mat-label>
        <input
          type="text"
          matInput
          placeholder="Identificador de comunidad"          
          autocomplete="off"
          #idCommunity
        />
        <mat-icon matSuffix>apartment</mat-icon>
      </mat-form-field>
      <button
      class="btn"
      style="max-width: 21rem; width: 100%;"
      color="primary"
      type="button"
      mat-raised-button
      [disabled]="boolSpinner"
      (click)="toValidateCommunity(idCommunity.value)"
    >
      <mat-icon>shield</mat-icon> ACCEDER COMUNIDAD
    </button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment