Is there a way to have AngularJS evaluate an expression within model data?
HTML:
{{Txt}}
Model:>
You can use the $interpolate service to interpolate the string...
function ctrl ($scope, $interpolate) {
$scope.Txt = "This is some text {{Rest}}";
$scope.Rest = "and this is the rest of it.";
$scope.interpolate = function (value) {
return $interpolate(value)($scope);
};
}
{{ Txt }}
{{ interpolate(Txt) }}
JSFiddle