Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

249
Views
¿Cómo usar <md-error> en Angular Material 2?

Estoy tratando de mostrar un mensaje de error cuando una entrada requerida no es válida en Angular Material 2. Hay un ejemplo en la aplicación de demostración de Angular Material :

 <form novalidate> <h4>Inside a form</h4> <md-input-container> <input mdInput name="example" placeholder="example" [(ngModel)]="errorMessageExample3" required> <md-error>This field is required</md-error> </md-input-container> <button color="primary" md-raised-button>Submit</button> </form>

Resultado Esperado

Desafortunadamente, cuando intento hacer lo mismo, obtengo:

 Unhandled Promise rejection: Template parse errors: 'md-error' is not a known element: 1. If 'md-error' is an Angular component, then verify that it is part of this module. 2. If 'md-error' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

¿Qué se supone que debo hacer para usar <md-error> ?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

¿Ha agregado MaterialModule a su appModule?

es decir

 @NgModule({ imports: [ ... MaterialModule ], ... })

Actualizar:

md-error es una nueva directiva que aún no se ha lanzado (a partir de la versión beta.2), probablemente será parte del próximo lanzamiento, supongo. Puede encontrar más información aquí: https://github.com/angular/material2/pull/3560

Mientras tanto, puedes usar md-hint .

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!