Setting controller.$options
in the link
function seems to work for debouncing blur events:
controller.$options = {
updateOn : 'blur',
debounce : 3000
};
...but if I try the same for default events, the model is never updated:
controller.$options = {
updateOn : 'default',
debounce : 3000
};
When using the ng-model-options
directive instead, everything works as expected.
See http://plnkr.co/edit/KLrSrs2Jw7pkoAUNRJDf?p=preview
for your case you could try
ngModelController.$options = {
updateOn: 'blur',
updateOnDefault: true,
debounce: {
'blur': 2000,
'default': 3000
}
};
but now (ng1.6+) you must do it like (read more here, here, and here):
ngModelController.$overrideModelOptions({
updateOn: 'blur',
updateOn: 'default',
debounce: {
'blur': 2000,
'default': 3000
}
});
Looking at the source of the ngModelOptions directive, it appears that instead of setting updateOn : 'default'
, you need to set controller.$options.updateOnDefault = true;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With