39 lines
999 B
JavaScript
39 lines
999 B
JavaScript
import ngModule from '../../module';
|
|
import './style.scss';
|
|
|
|
export default class Controller {
|
|
constructor($element, $translate, $attrs) {
|
|
this.element = $element[0];
|
|
this._ = $translate;
|
|
this.hasInfo = Boolean($attrs.info);
|
|
this.info = $attrs.info || null;
|
|
}
|
|
set label(value) {
|
|
let label = this.element.querySelector('vn-label');
|
|
label.textContent = this._.instant(value);
|
|
this._label = value;
|
|
}
|
|
get label() {
|
|
return this._label;
|
|
}
|
|
set value(value) {
|
|
let span = this.element.querySelector('span');
|
|
span.title = value;
|
|
span.textContent = value ? value : '-';
|
|
this._value = value;
|
|
}
|
|
get value() {
|
|
return this._value;
|
|
}
|
|
}
|
|
Controller.$inject = ['$element', '$translate', '$attrs'];
|
|
|
|
ngModule.component('vnLabelValue', {
|
|
controller: Controller,
|
|
template: require('./label-value.html'),
|
|
bindings: {
|
|
label: '@',
|
|
value: '@'
|
|
}
|
|
});
|