Permalink
Browse files

fix(chips): remove last chip without freezing browser

resolves #60
  • Loading branch information...
ZHollingshead committed Apr 17, 2017
1 parent 0132d7f commit 78b224cf58e6f25fb594deb22ac1b4eaf98ce56a
Showing with 5 additions and 25 deletions.
  1. +5 −25 src/chip-input/ux-chip-input.ts
@@ -15,7 +15,7 @@ export class UxChipInput implements Themable {
@bindable public readonly: any = false;
@bindable public theme = null;
@bindable public type: any;
- @bindable public separator: string;
+ @bindable public separator: string = ', ';
@bindable({ defaultBindingMode: bindingMode.twoWay })
public value: any = undefined;
@@ -137,33 +137,13 @@ export class UxChipInput implements Themable {
}
public chipsChanged() {
- let seperator = ', ';
+ let chipValue: string | null = this.chips.join(this.separator);
- if (this.separator) {
- seperator = this.separator;
+ if (chipValue === '') {
+ chipValue = null;
}
- this.value = this.chips.join(seperator);
- }
-
- public valueChanged() {
- if (this.value === null) {
- return;
- }
-
- let seperator = ', ';
-
- if (this.separator) {
- seperator = this.separator;
- }
-
- let newValue: string | null = this.chips.join(seperator);
-
- if (newValue === '') {
- newValue = null;
- }
-
- this.value = newValue;
+ this.value = chipValue;
}
public disabledChanged(newValue: any) {

0 comments on commit 78b224c

Please sign in to comment.