Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

257
Vistas
Angular 2 validation does not display angular 2 built in pop up

I have a form in Angular 2 look like this :

<form #conForm="ngForm" id="formConnection" >
    <div class="row">
        <label>Name</label>
        <input id="inputName"
               type="text"
               placeholder="Name (required)"
               required minlength="3"
               [(ngModel)]="connector.name"
               ngControl="nameField"
               #nameField="ngModel"
               name="formInput" />
        <span *ngIf="nameField.errors && (nameField.dirty || nameField.touched)">
            <span *ngIf="nameField.errors.required">Enter name</span>
        </span>
    </div>

    <div class="row">
        <label>Description</label>
        <input [(ngModel)]="connector.description"
               id="inputDescription"
               type="text"
               required minlength="3"
               ngControl="descField"
               name="descriptionInput"
               #descField="ngModel" />
    </div>

<button type="submit" id="publishConButton"
 (click)="conForm.valid && Publish()" [disabled]="isSaving">Publish</button>

it basically asks for name and description then I have a button to publish the content been typed in. This validation works it won't call the function Publish unless all the validation is satisfied. However all the popup dialog that angular 2 present nicely in each input field does not show up anymore. So I have to add my own field to display the message which I do not like.

in my previous attempt in my button I only did

 <button type="submit" id="publishConButton"
 (click)="Publish()" [disabled]="isSaving">Publish</button>

In this the popup boxes showed up nicely and shows minimum 3 characters needed in a nice popup built into angular. But unfortunately the Publish function does gets called in this and an invalid connection is been published. Anyone know why is this?

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda