Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

input-container: not showing ng-messages error by default even when md-auto-hide="false" is applied #9723

Closed

Description

@nghilevi

Actual Behavior:

  • What is the issue? *: Under md-input-container, when applied md-auto-hide="false" tong-messages, error message(s) is not shown by default.
  • What is the expected behavior?: If the input is invalid, error message(s) should be shown by default when md-auto-hide="false" is applied on ng-messages.

CodePen (or steps to reproduce the issue): *

Angular Versions: *

  • Angular Version: 1.5.5
  • Angular Material Version: 1.1.1

Additional Information:

  • Browser Type: * Any
  • Browser Version: * Any
  • OS: * Any
  • Stack Traces: Any

Activity

  1. changed the title [-]md-input-container not showing ng-messages error by default even when md-auto-hide="false"[/-] [+]md-input-container not showing ng-messages error by default even when md-auto-hide="false" is applied[/+] on Sep 29, 2016
  2. nghilevi commented on Sep 29, 2016

    @nghilevi
    Author

    Currently my quick and dirty fix in our project is:

    Add these lines of code to
    https://github.com/angular/material/blob/master/src/components/input/input.scss

    .ng-pristine.ng-invalid{
      md-input-container {
        .md-input-messages-animation:not(.md-auto-hide){
          .md-input-message-animation {
            &:not(.ng-animate) {
              opacity: 1;
              margin-top: 0;
            }
          }
        }
      }
    }
    

    This ensure that the error message will be appeared from the start when there is no md-auto-hide.

    Also I replaced this logic:
    https://github.com/angular/material/blob/master/src/components/input/input.js#L993-L995
    with this:

    if (messages.hasClass('md-auto-hide') && !container.hasClass('md-input-invalid')) {
        return $animateCss(element, {});
    }
    
    if (alreadyVisible && !messages.hasClass('md-auto-hide') && container.hasClass('md-input-invalid')) {
       return $animateCss(element, {});
    }
    

    Still the label is NOT colored red by default. I have tried this but it didn't work:

    .ng-pristine, .ng-invalid{
      md-input-container {
        label ~ .md-input-messages-animation:not(.md-auto-hide){
          color:red;
        }
      }
    }
    

    I guess to make that possible some logic inside inputTextareaDirectiveshould be changed.

  3. added this to the 1.1.2 milestone on Oct 14, 2016
  4. added
    P4: minor
    on Oct 14, 2016
  5. self-assigned this
    on Oct 25, 2016
  6. mikila85 commented on Oct 30, 2016

    @mikila85

    +1

  7. modified the milestones: 1.1.2, 1.1.3 on Nov 29, 2016
  8. 6 remaining items

  9. added
    has: Pull Request
    on Jan 10, 2017
  10. changed the title [-]md-input-container not showing ng-messages error by default even when md-auto-hide="false" is applied[/-] [+]input-container: not showing ng-messages error by default even when md-auto-hide="false" is applied[/+] on Feb 12, 2019
  11. modified the milestones: Future, 1.1.5 on Feb 12, 2019
  12. Splaktar commented on Feb 12, 2019

    @Splaktar
    Contributor

    Fixed in 1.1.5 via 0151b4b.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4: minorhas: Pull Requestresolution: fixedui: CSS

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions