import ngModule from '../../module'; import Component from '../../lib/component'; import './style.scss'; export default class Controller extends Component { constructor($element, $scope, $attrs) { super($element, $scope); this.hasInfo = Boolean($attrs.info); this.info = $attrs.info || null; } get model() { return this._model; } set model(value) { if (value === null) return; if (this.model === true) value = false; else if (this.model === false && this.tripleState) value = null; this.emit('change', {value}); this._model = value; } set field(value) { if (typeof value === 'number') value = Boolean(value); this._model = value; } get field() { return this._model; } get isIntermediate() { return this.intermediate || this.model === null || this.model === undefined; } get isChecked() { return this.checked || this.model === true; } } Controller.$inject = ['$element', '$scope', '$attrs']; ngModule.component('vnCheck', { template: require('./check.html'), controller: Controller, bindings: { field: '=?', label: '@?', disabled: '