mdChips: empty chips are added as contact chips #2268
Description
It is relatively easy to add empty chips in the current implementation of contact chips demo. Just type some text and press the enter key without selecting a suggestion from the dropdown.
This happens in the following situations:
- You type the full name of one of the contacts.
- You type the full email-address of one of the contacts.
- You type an email-address that is not in the contacts.
- You type some random string, which does not match any of the above.
In situation 1 and 2, it would be nice if the corresponding contact would be added as a chip. This could be done after pressing the enter key; since names often contain spaces it would be hard otherwise.
In situation 3, there are I think (at least) two use cases:
a. You want to restrict the user to only allow chips corresponding to contacts in the predefined set. The entered email-address should be discarded.
b. You want to allow the user to add additional email-addresses of contacts who are not in the predefined set. Useful for e.g. a email-form. The entered email-address should be added as a chip without image.
In situation 4, the card should be discarded. Or is there also a valid use case for creating a chip with the entered text?
Currently, situations 1 to 4 lead to an empty chip / contact being added: