44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
import ngModule from '../../module';
|
|
import './style.scss';
|
|
|
|
export default class Textarea {
|
|
constructor($element, $scope, $attrs, vnTemplate) {
|
|
this.$ = $scope;
|
|
this.$attrs = $attrs;
|
|
this.element = $element;
|
|
vnTemplate.normalizeInputAttrs($attrs);
|
|
this.textarea = this.element[0].querySelector('textarea');
|
|
this.rows = null;
|
|
}
|
|
set model(value) {
|
|
this._model = value;
|
|
this.mdlUpdate();
|
|
}
|
|
set rows(value) {
|
|
this.textarea.rows = value ? value : 3;
|
|
}
|
|
get model() {
|
|
return this._model;
|
|
}
|
|
mdlUpdate() {
|
|
let mdlField = this.element[0].firstChild.MaterialTextfield;
|
|
if (mdlField)
|
|
mdlField.updateClasses_();
|
|
componentHandler.upgradeElement(this.element[0].firstChild);
|
|
}
|
|
}
|
|
Textarea.$inject = ['$element', '$scope', '$attrs', 'vnTemplate'];
|
|
|
|
ngModule.component('vnTextarea', {
|
|
template: require('./textarea.html'),
|
|
controller: Textarea,
|
|
bindings: {
|
|
model: '=model',
|
|
label: '@?',
|
|
rows: '@?',
|
|
name: '@?',
|
|
disabled: '<?',
|
|
rule: '@?'
|
|
}
|
|
});
|