Skip to content
This repository was archived by the owner on Jun 6, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion angular-ckeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
// Sync view on specific events.
['dataReady', 'change', 'blur', 'saveSnapshot'].forEach(function (event) {
controller.onCKEvent(event, function syncView() {
ngModelController.$setViewValue(controller.instance.getData() || '');
setViewValueIfNeed(ngModelController, controller);
});
});

Expand Down Expand Up @@ -74,6 +74,14 @@
});
});
};
var setViewValueIfNeed = function(ngModelController, controller) {
// do not create object in scope, if the model refers to an object.property
if (controller.instance.getData()) {
ngModelController.$setViewValue(controller.instance.getData());
} else if (ngModelController.$viewValue) {
ngModelController.$setViewValue('');
}
}
}
};
}
Expand Down