25 lines
792 B
JavaScript
25 lines
792 B
JavaScript
|
import ngModule from '../../module';
|
||
|
import template from './check.html';
|
||
|
import './style.css';
|
||
|
|
||
|
directive.$inject = ['vnTemplate'];
|
||
|
export default function directive(vnTemplate) {
|
||
|
return {
|
||
|
restrict: 'E',
|
||
|
template: (_, $attrs) =>
|
||
|
vnTemplate.getNormalized(template, $attrs, {
|
||
|
enabled: 'true',
|
||
|
className: 'mdl-checkbox__input'
|
||
|
}),
|
||
|
link: function(scope, element, attrs) {
|
||
|
scope.$watch(attrs.model, () => {
|
||
|
let mdlField = element[0].firstChild.MaterialCheckbox;
|
||
|
if (mdlField)
|
||
|
mdlField.updateClasses_();
|
||
|
});
|
||
|
componentHandler.upgradeElement(element[0].firstChild);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
ngModule.directive('vnCheck', directive);
|