Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

260
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda