Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ngAfterViewInit() {
const foundation = this._foundation = new MDCSwitchFoundation(this._adapter);
foundation.setDisabled(this.disabled);
foundation.setChecked(this.checked);
}
getDefaultFoundation() {
const adapter: MDCSwitchAdapter = {
addClass: (className: string) => this._getHostElement().classList.add(className),
removeClass: (className: string) => this._getHostElement().classList.remove(className),
setNativeControlChecked: (checked: boolean) => this._getInputElement().checked = checked,
setNativeControlDisabled: (disabled: boolean) => this._getInputElement().disabled = disabled
};
return new MDCSwitchFoundation(adapter);
}
getDefaultFoundation() {
return new MDCSwitchFoundation({
addClass: (className: string) => this.root.addClass(className),
removeClass: (className: string) => this.root.removeClass(className),
setNativeControlChecked: (checked: boolean) =>
this.nativeControl.setProp('checked', checked),
setNativeControlDisabled: (disabled: boolean) =>
this.nativeControl.setProp('disabled', disabled)
});
}