26 lines
821 B
JavaScript
26 lines
821 B
JavaScript
|
import ngModule from '../../module';
|
||
|
import template from './combo.html';
|
||
|
|
||
|
directive.$inject = ['vnTemplate'];
|
||
|
export function directive(vnTemplate) {
|
||
|
return {
|
||
|
restrict: 'E',
|
||
|
transclude: true,
|
||
|
template: (_, $attrs) =>
|
||
|
vnTemplate.getNormalized(template, $attrs, {
|
||
|
label: 'Label',
|
||
|
enabled: 'enabled',
|
||
|
class: 'mdl-textfield__input'
|
||
|
}),
|
||
|
link: function(scope, element, attrs) {
|
||
|
scope.$watch(attrs.model, () => {
|
||
|
let mdlField = element[0].firstChild.MaterialTextfield;
|
||
|
if (mdlField)
|
||
|
mdlField.updateClasses_();
|
||
|
});
|
||
|
componentHandler.upgradeElement(element[0].firstChild);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
ngModule.directive('vnCombo', directive);
|