36 lines
785 B
JavaScript
36 lines
785 B
JavaScript
import ngModule from '../../module';
|
|
import Input from '../../lib/input';
|
|
import './style.scss';
|
|
|
|
export default class Button extends Input {
|
|
constructor($element) {
|
|
super($element);
|
|
this.$element = $element;
|
|
this.input = this.element.querySelector('.mdl-button');
|
|
|
|
$element[0].addEventListener('click', event => {
|
|
if (this.disabled)
|
|
event.stopImmediatePropagation();
|
|
});
|
|
}
|
|
|
|
$onInit() {
|
|
if (!this.type) {
|
|
this.type = 'button';
|
|
}
|
|
}
|
|
}
|
|
Button.$inject = ['$element'];
|
|
|
|
ngModule.component('vnButton', {
|
|
controller: Button,
|
|
template: require('./button.html'),
|
|
bindings: {
|
|
label: '@?',
|
|
disabled: '<?',
|
|
icon: '@?',
|
|
type: '@?'
|
|
}
|
|
});
|
|
|