Skip to content

Commit

Permalink
feat(md-chips): add first attempt on chip editor
Browse files Browse the repository at this point in the history
  • Loading branch information
Thanood committed Jul 25, 2016
1 parent 96c0542 commit 5af48a5
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/chip/chips.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import {bindable, customAttribute} from 'aurelia-templating';
import {inject} from 'aurelia-dependency-injection';
import {getLogger} from 'aurelia-logging';

@customAttribute('md-chips')
@inject(Element)
export class MdChips {
@bindable() data = [];
@bindable() placeholder = '';
@bindable() secondaryPlaceholder = '';
constructor(element) {
this.element = element;
this.log = getLogger('md-chips');
this.onChipAdd = this.onChipAdd.bind(this);
this.onChipDelete = this.onChipDelete.bind(this);
this.onChipSelect = this.onChipSelect.bind(this);
}
attached() {
let options = {
data: this.data,
placeholder: this.placeholder,
secondaryPlaceholder: this.secondaryPlaceholder
};
$(this.element).material_chip(options);
$(this.element).on('chip.add', this.onChipAdd);
$(this.element).on('chip.delete', this.onChipDelete);
$(this.element).on('chip.select', this.onChipSelect);
}

detached() {
//
}

onChipAdd(e, chip) { }
onChipDelete(e, chip) { }
onChipSelect(e, chip) {}
}
1 change: 1 addition & 0 deletions src/config-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export class ConfigBuilder {

useChip(): ConfigBuilder {
this.globalResources.push('./chip/chip');
this.globalResources.push('./chip/chips');
return this;
}

Expand Down

0 comments on commit 5af48a5

Please sign in to comment.