question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

md-error with *ngIf having formcontrolsvalidation in md-input-container not working

See original GitHub issue

md-error with *ngIf not working whereas using md-error outside of md-input-container with *ngIf works as expected

Here is my code:

<form [formGroup]="searchForm" (ngSubmit)="onSubmit()" novalidate>
        <md-input-container>
            <input mdInput type="text" placeholder="First Name"
                   formControlName="firstName" >
        </md-input-container>
        <md-input-container>
            <input mdInput type="text" placeholder="Middle Name"
                   formControlName="middleName">
            <md-error  *ngIf="!searchForm.value.firstName && !searchForm.pristine">
                Please Enter Middle Name with First Name
            </md-error>
        </md-input-container>
         <button md-raised-button> Search </button>
         <button md-raised-button type="reset"> Clear </button>
</form>

How can I resolve this?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

0reactions
angular-automatic-lock-bot[bot]commented, Sep 6, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

md-error with *ngIf doesn't work #4027 - angular/components
<md-input-container> <input mdInput [(ngModel)]="sample" ... I have problems making Reactive form with FormGroup display md-error . md-hint ...
Read more >
Angular : How to show md-error which is inside md-input ...
I want to show the 2nd md-error with the help of an event or any flag but not the value inside the ngModel...
Read more >
Chapter 9: Forms - Angular in Action - liveBook · Manning
The form control has not been in focus. The MdError element is from the Material Design library and shows a little validation error...
Read more >
Angular Forms and Validations
So we have to create our FormGroup like we explained above and create a FormControl to define our email form control with its...
Read more >
Angular 2 / Material – md-error not displayed with custom validator ...
I am having some trouble getting validation errors to display on a model driven form with Angular (v4.3.6). In my model, I have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found