mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(chips): Fix adding new chips on demo page (#3426)
This commit is contained in:
committed by
tinayuangao
parent
f02af521b9
commit
2d16a249db
@@ -1,4 +1,4 @@
|
||||
import {Component, ElementRef} from '@angular/core';
|
||||
import {Component} from '@angular/core';
|
||||
|
||||
export interface Person {
|
||||
name: string;
|
||||
@@ -39,10 +39,10 @@ export class ChipsDemo {
|
||||
alert(message);
|
||||
}
|
||||
|
||||
add(input: ElementRef): void {
|
||||
if (input.nativeElement.value && input.nativeElement.value.trim() != '') {
|
||||
this.people.push({ name: input.nativeElement.value.trim() });
|
||||
input.nativeElement.value = '';
|
||||
add(input: HTMLInputElement): void {
|
||||
if (input.value && input.value.trim() != '') {
|
||||
this.people.push({ name: input.value.trim() });
|
||||
input.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user