Skip to content

Commit

Permalink
feat(md-checkbox): forward blur event
Browse files Browse the repository at this point in the history
  • Loading branch information
Ullfis committed Sep 5, 2016
1 parent ddacfbd commit c5c451e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/checkbox/checkbox.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<input type="checkbox" id="${controlId}" ref="checkbox" />
<input type="checkbox" id="${controlId}" ref="checkbox" blur.trigger="blur()" />
<label for="${controlId}">
<slot></slot>
</label>
Expand Down
6 changes: 6 additions & 0 deletions src/checkbox/checkbox.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { bindable, customElement } from 'aurelia-templating';
import { DOM } from 'aurelia-pal';
import { bindingMode } from 'aurelia-binding';
import { inject } from 'aurelia-dependency-injection';
import { AttributeManager } from '../common/attributeManager';
Expand Down Expand Up @@ -37,6 +38,11 @@ export class MdCheckbox {
this.checkbox.addEventListener('change', this.handleChange);
}

blur() {
const event = DOM.createCustomEvent('blur');
this.element.dispatchEvent(event);
}

detached() {
this.attributeManager.removeClasses(['filled-in', 'disabled']);
this.checkbox.removeEventListener('change', this.handleChange);
Expand Down

0 comments on commit c5c451e

Please sign in to comment.