Skip to content

Commit 03ed521

Browse files
committed
Fixes #168.
1 parent e124ecf commit 03ed521

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/angular-froala.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,6 @@
102102
froalaInitOptions = (froalaInitOptions || {});
103103
ctrl.options = angular.extend({}, defaultConfig, froalaConfig, scope.froalaOptions, froalaInitOptions);
104104

105-
if (ctrl.options.immediateAngularModelUpdate) {
106-
ctrl.listeningEvents.push('keyup');
107-
}
108-
109105
ctrl.registerEventsWithCallbacks('froalaEditor.initializationDelayed', function() {
110106
ngModel.$render()
111107
});
@@ -136,7 +132,7 @@
136132

137133
ctrl.initListeners = function() {
138134
if (ctrl.options.immediateAngularModelUpdate) {
139-
ctrl.froalaElement.on('keyup', function() {
135+
ctrl.froalaElement.on('froalaEditor.keyup', function() {
140136
scope.$evalAsync(ctrl.updateModelView);
141137
});
142138
}
@@ -146,9 +142,10 @@
146142
});
147143

148144
element.bind('$destroy', function() {
149-
element.off(ctrl.listeningEvents.join(" "));
150-
element.froalaEditor('destroy');
151-
element = null;
145+
if (element) {
146+
element.froalaEditor('destroy');
147+
element = null;
148+
}
152149
});
153150
};
154151

0 commit comments

Comments
 (0)