0
我正在使用Angular JS 1.5.6,並且我希望programmaticaly取消同步$ viewValue和$ modelValue,我希望$ viewValue保持其當前值,但$ modelValue爲設置爲undefined。我試過modelCtrl.$modelValue = undefined
但它不起作用。
這裏是我的指令
function blurFocusDirective() {
return {
require: 'ngModel',
link: function(scope, elm, attrs, modelCtrl) {
elm.on('blur', function() {
console.log('capture blur event');
modelCtrl.$modelValue = undefined;
});
}
};}
的代碼,我有我的plunkered問題。