I had the same issue and could not figure out a solution for a while.
The CodeMirror instance will be updated once a scope variable/function returns true.
That can be determined by a function doing a calculation on the value being displayed, but in my snippet I have my data updated from the result of a broadcasted event.
I set the scope variable to be checked to true, and then with a short delay, I change it back to false.
$scope.$on(ART_EVENTS.updateOverview, function (event, data) {
$log.info("received overviewData in articleController.");
// do stuff with the data
// ...
$scope.refreshCodemirror = true;
$timeout(function () {
$scope.refreshCodemirror = false;
}, 100);
});
And then in the view:
<textarea ui-codemirror ng-model="x" ui-refresh='refreshCodemirror'></textarea>
I do realise that there might be better solutions, but this works for what I need.