Updating ng-model on click stops updating the editor contents after a few changes #263
Description
I have a screen that allows the user to edit several HTML sections in the same page. So there's a $scope
variable called contents
, that has a bunch of objects with HTMLs in them, and a single editor, with the ng-model
pointing to $scope.content
. When the user selects a file, the ng-click
event points $scope.content
to the appropriate item in $scope.contents
.
When the user writes a bunch of text in the editor, then clicks another item, the model is appropriately updated and the editor is reloaded with the contents of the other item. When this is repeated 3 or 4 times, the editor stops updating its content, and stops updating the model. A few more clicks here and there and both are updated, but some of the things the user typed on the editor are not saved.
Example: https://plnkr.co/edit/ufSY8KoYJTjBCeBTSpTw?p=preview
How to reproduce:
- Write a bunch of text in the editor
- Click the next section button
- Write a different bunch of text in the editor
- Repeat this procedure a few times
- The editor will still show the contents of the previous section and the model will have the current section blank and the previous section filled