Reputation: 367
Is it possible to render externalized strings (passed from server in my case) in the controller?
My use case: I'm using angular-toastr as an alert service, and I must pass message and title to the toastr object. The tricky part is when the strings contain scope variables, e.g: stringFromServer = "Something with {{someVariable}} went wrong"
.
I know in my HTTP callback about the someVariable
but I want to render it to the string before passing it as a message to the alert service.
Is this possible, and what would be the best way?
Upvotes: 2
Views: 279
Reputation:
Assuming the server can render the string with a $scope.variable placeholder, $interpolate seems like what you're looking for.
Please see documentation
Upvotes: 2