I want to evaluate a string in the form of "my name is {{name}}" where name is present in the current scope (same way angular does for html content).
This should be simple but i haven't managed to achieve that with eval nor compile.
I want to evaluate a string in the form of "my name is {{name}}" where name is present in the current scope (same way angular does for html content).
This should be simple but i haven't managed to achieve that with eval nor compile.
Use the $interpolate service, like:
console.log("using $interpolate: " + $interpolate("'" + s + "'")(scope));
Compiles a string with markup into an interpolation function. This service is used by the HTML $compile service for data binding.