Skip to content
This repository was archived by the owner on May 25, 2019. It is now read-only.

Commit f506149

Browse files
committed
fix: undefined newValue watched
1 parent 0f5802e commit f506149

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/ui-codemirror.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,16 @@ angular.module('ui.codemirror', [])
4141
if (iAttrs.uiCodemirror || iAttrs.uiCodemirrorOpts) {
4242
var codemirrorDefaultsKeys = Object.keys(window.CodeMirror.defaults);
4343
scope.$watch(iAttrs.uiCodemirror || iAttrs.uiCodemirrorOpts, function updateOptions(newValues, oldValue) {
44+
if (! angular.isObject(newValues)){
45+
return;
46+
}
4447
codemirrorDefaultsKeys.forEach(function (key) {
45-
if (newValues.hasOwnProperty(key) && newValues[key] !== oldValue[key]) {
48+
if (newValues.hasOwnProperty(key)) {
49+
50+
if (oldValue && newValues[key] === oldValue[key]){
51+
return;
52+
}
53+
4654
codeMirror.setOption(key, newValues[key]);
4755
}
4856
});

0 commit comments

Comments
 (0)