My server side code (GSP) is dynamically generating HTML for me in the following format:
<span>
<g:generateAmount />
</span>
I am integrating this into an Angular controller and I want to be able to bind a scope variable to the span
:
<span ng-bind="subtotal">
<g:generateAmount />
</span>
The issue I am facing is that after binding, the inner text disappears because the subtotal value is not set in the controller during initialization (although updating it from the controller works fine). The ng-model
also does not seem to read it.
Query
Is there a way to bind to a node while preserving the data inside that node? For example, in the scenario above, $scope.subtotal would hold the output of <g:generateAmount />
. This way, I could modify the subtotal
from the controller and see those changes reflected.
View example: http://jsfiddle.net/robcampo/zg6GE/2/