Communities for your favorite technologies. Explore all Collectives
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I have a element that prints a message. That message contains dynamic values. So, how can i evaluate what's inside the message before it gets evaluated inside the tag?
$scope.name = 'John' $scope.message = 'Hello {{name}}'
<li>{{message}}<li>
You can use the $interpolate service to evaluate that expression.
$interpolate
.controller('DemoController', function($scope, $interpolate) { $scope.name = 'John'; $scope.message = $interpolate('Hello {{name}}')($scope); });
Add a comment
ryeballar is right. or you can do it like this:
$scope.name = 'John' $scope.message = 'Hello'+ $scope.name; <li>{{message}}<li>
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.