Is it possible to parse a string with scope variables angularjs ?

haki

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.

JSBIN example

CD..

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.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Setting dynamic scope variables in AngularJs - scope.<some_string>

From Dev

AngularJs scope variables in console

From Dev

Testing AngularJS scope variables

From Dev

Passing String scope variables as arguments to $http.get in AngularJS

From Dev

How i can parse or evaluate string with variables in AngularJS?

From Dev

AngularJS = scope in an = scope causing parse syntax error

From Dev

AngularJS: accessing scope variables in $routeProvider

From Dev

Angularjs $scope variables not updating in view

From Dev

Angularjs $scope variables not updating in view

From Dev

AngularJS: accessing scope variables in $routeProvider

From Dev

Angular parse string to scope object

From Dev

Parse string to appropriate variables

From Dev

Parse variables in PHP string

From Dev

Parse a string into serval variables

From Dev

Parse Async Calls not updating $scope variable in AngularJS

From Dev

AngularJS parse JSON data with scope variable

From Dev

String with variables binding in Angularjs

From Dev

Is it possible to output entire scope in template Angularjs?

From Dev

AngularJS: Initialize nested scope variables in controller

From Dev

Auto-updating scope variables in angularjs

From Java

Access scope variables from a filter in AngularJS

From Dev

Angularjs passing variables to a directive with an inherited (not isolated) scope

From Dev

AngularJS set ng-controller with scope variables

From Dev

Initialize $scope variables for multiple controllers - AngularJS

From Dev

Create dynamic scope variables in AngularJs inside loop

From Dev

How to add Dynamic Scope variables to a for loop in angularjs?

From Dev

can't bind scope variables in angularjs

From Dev

Changing AngularJS scope variables from an inside function

From Dev

Ionic: AngularJS Variables not Updating DOM with $scope

Related Related

  1. 1

    Setting dynamic scope variables in AngularJs - scope.<some_string>

  2. 2

    AngularJs scope variables in console

  3. 3

    Testing AngularJS scope variables

  4. 4

    Passing String scope variables as arguments to $http.get in AngularJS

  5. 5

    How i can parse or evaluate string with variables in AngularJS?

  6. 6

    AngularJS = scope in an = scope causing parse syntax error

  7. 7

    AngularJS: accessing scope variables in $routeProvider

  8. 8

    Angularjs $scope variables not updating in view

  9. 9

    Angularjs $scope variables not updating in view

  10. 10

    AngularJS: accessing scope variables in $routeProvider

  11. 11

    Angular parse string to scope object

  12. 12

    Parse string to appropriate variables

  13. 13

    Parse variables in PHP string

  14. 14

    Parse a string into serval variables

  15. 15

    Parse Async Calls not updating $scope variable in AngularJS

  16. 16

    AngularJS parse JSON data with scope variable

  17. 17

    String with variables binding in Angularjs

  18. 18

    Is it possible to output entire scope in template Angularjs?

  19. 19

    AngularJS: Initialize nested scope variables in controller

  20. 20

    Auto-updating scope variables in angularjs

  21. 21

    Access scope variables from a filter in AngularJS

  22. 22

    Angularjs passing variables to a directive with an inherited (not isolated) scope

  23. 23

    AngularJS set ng-controller with scope variables

  24. 24

    Initialize $scope variables for multiple controllers - AngularJS

  25. 25

    Create dynamic scope variables in AngularJs inside loop

  26. 26

    How to add Dynamic Scope variables to a for loop in angularjs?

  27. 27

    can't bind scope variables in angularjs

  28. 28

    Changing AngularJS scope variables from an inside function

  29. 29

    Ionic: AngularJS Variables not Updating DOM with $scope

HotTag

Archive