-
Notifications
You must be signed in to change notification settings - Fork 172
ng-model of ace editor is not changing when I'm dynamically changing few lines of editor. #178
Comments
Hey @prashant-pokhriyal did you find a solution to this issue? |
If you are looking for 2 way binding then this is how it works. In Html:
in controller:
You need to set the model as a JSON object so that the scopes issues do not arise. |
So with this approach, ace should update the model value whenever the value of editor changes. right? In my case, instead of a human interaction with the editor, I have a button which when clicked inserts a text in the editor but same is not reflected in the model. Here's the Fiddle for the same - https://jsfiddle.net/ashitvora/q27ebeeq/38/ when I |
If your goal is to update Editor with some buttons you can easily do that with updating the model on the click handler of your button and it would work. and for the cursor moment: that happens because the cursor position is zero when there is no user interaction with the editor. |
I did try calculating the cursor position manually and setting it but it doesn't work.
|
In that case you'll loose the undo/redo history |
Firstly I'm loading content of editor by initialising ng-model of editor. Then in controller I'm changing few lines, but when I'm printing ng-model value it is showing the previous one.
The text was updated successfully, but these errors were encountered: