Skip to content

md-chips example doesn't work #3143

Closed
Closed
@machtyn

Description

@machtyn

Bug, feature request, or proposal:

Fix md-chips example as given below

What is the expected behavior?

A new chip should be created when some text is entered on the input line and the Enter button pressed.

What is the current behavior?

When run in plunkr, a new chip was not created and errors were generated

What are the steps to reproduce?

Run the chips demo in plunkr
Providing a Plunker (or similar) is the best way to get the team to see your issue.
Plunker template: http://plnkr.co/edit/o077B6uEiiIgkC0S06dd

Is there anything else we should know?

Suggestions to fix:
In chips-demo.html:47
<input mdInput (keyup.enter)="add($event)" placeholder="New Contributor...">

In chips-demo.ts:42 (add method)

add(input: KeyboardEvent): void {
    input.target.value.split(',').forEach( v => {
        this.people.push({name: v.trim()});
    });
    input.target.value = '';
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions