Home > Blockchain >  AngularJs: How to interpolate an interpolated string?
AngularJs: How to interpolate an interpolated string?

Time:03-02

I'm trying to Interpolate a string coming from a database which looks like this "Users({{users_count || 0}})", and when I interpolate it using {{}} or ng-bind it doesn't get interpolated, because in the HTML I write {{data.usersCount}} and the page interpolates the data as text not as js, (what I intended the page to render is Users(8), and what gets rendered is Users({{users_count || 0}})). So my question is how to interpolate the string that was interpolated from the usersCount variable?

CodePudding user response:

One way is to use $interpolate, as in

$interpolate("Users({{users_count || 0}})")($scope)
  • Related