27 lines
804 B
JavaScript
27 lines
804 B
JavaScript
import ngModule from '../../module';
|
|
|
|
directive.$inject = ['vnTemplate'];
|
|
export default function directive(vnTemplate) {
|
|
return {
|
|
restrict: 'E',
|
|
template: (_, $attrs) =>
|
|
vnTemplate.getNormalized(template, $attrs, {
|
|
className: 'mdl-switch__input',
|
|
label: ''
|
|
}),
|
|
link: function(scope, element, attrs) {
|
|
scope.$watch(attrs.model, () => {
|
|
let mdlField = element[0].firstChild.MaterialSwitch;
|
|
if (mdlField)
|
|
mdlField.updateClasses_();
|
|
});
|
|
componentHandler.upgradeElement(element[0].firstChild);
|
|
}
|
|
};
|
|
}
|
|
ngModule.directive('vnSwitch', directive);
|
|
|
|
export function factory() {
|
|
}
|
|
ngModule.factory('vnSwitchMdlFactory', factory);
|