Is there a way to have AngularJS evaluate an expression within model data?
HTML:
<p>
{{Txt}}
</p>
Model:
{
Txt: "This is some text {{Rest}}"
}
{
Rest: "and this is the rest of it."
}
The end result would be: This is some text and this is the rest of it
.
As you are using javascript for the model you can do something simple like this:
And in the view, keep your
<p>{{txt}}</p>
Alternatively you can string the expressions together
<p>{{txt}} {{rest}}</p>
You can execute JS within the brackets:
Or create a function that returns the text you want:
You can use the
$interpolate
service to interpolate the string...JSFiddle