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.

bug(chips-input) NO error state !

See original GitHub issue

Bug, feature request, or proposal:

Bug

<form [formGroup]='group'>
  <mat-form-field class="example-chip-list">
    <mat-chip-list #chipList>
      <mat-chip *ngFor="let fruit of fruits" [selectable]="selectable"
              [removable]="removable" (removed)="remove(fruit)">
        {{fruit.name}}
        <mat-icon matChipRemove *ngIf="removable">cancel</mat-icon>
      </mat-chip>
      <!-- add formContorlName 'newFruit'  -->
      <input placeholder="New fruit..."
            formContorlName='newFruit'
            [matChipInputFor]="chipList"
            [matChipInputSeparatorKeyCodes]="separatorKeysCodes"
            [matChipInputAddOnBlur]="addOnBlur"
            (matChipInputTokenEnd)="add($event)">
    </mat-chip-list>
      <!-- add mat-error  -->
    <mat-error *ngIf="group.controls.newFruit.hasError('required')">required!</mat-error>
  </mat-form-field>
</form>

What is the expected behavior?

In this case, it can display error!

What is the current behavior?

If input is empty, no error will be displayed.

What are the steps to reproduce?

https://stackblitz.com/angular/pxxkxklrgaqg?file=app%2Fchips-input-example.html You can try it on your example…

What is the use-case or motivation for changing an existing behavior?

Displaying error prompts when errors occur

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

All latest

Is there anything else we should know?

No.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
josephperrottcommented, Nov 26, 2018

Closing as the form control should actually go onto the MatChipList since the list is what shows all of the control values.

You can see a fork of the stackblitz here in which if all of the chips are removed will show an error for required.

0reactions
angular-automatic-lock-bot[bot]commented, Sep 11, 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

Angular Matchiplist With Error Message (forked) - StackBlitz
Chips with input with error message. ... errorState">Too many chips</mat-error>. <mat-hint>Can only contain 3 chips max</. mat-hint>. </mat-form-field>.
Read more >
Angular material mat-chip-list with input not showing ...
Problem: When I remove all the elements from the input field, the parent form (formGroup) is marked as invalid but the error property...
Read more >
flutter_chips_input | Flutter Package - Pub.dev
Fixed bug where FocusNode was not being properly disposed; Applied pedantic rules and ... Resolve overlay assertion error '_overlay != null': is not...
Read more >
Flutter - Custom Form Field - Chip Input (No Extra Libs)
The video goes over how to create a Custom FormField in Flutter. Specifically, I am focusing on a chip input type field.
Read more >
ngx-chips - npm
Tag Input Component for Angular Build Status npm version ... Notice: the latest version on NPM may not reflect the branch master ....
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