1

In AngularJS I have a link which I need to insert a value from the scope into, I have tried this:

  $scope.go = function (path) {
            $location.path(path);
        };

 <a ng-click="go('/edit/{{my.id}}')"><span class="fa fa-pencil-square-o"></span></a>

but this just passes in /edit/%7B%7Bmy.id%

How is this possible in the template?

Prometheus
  • 32,405
  • 54
  • 166
  • 302

1 Answers1

2

did you try this?

$scope.go = function (id) {
        $location.path('/edit/'+id);
};

 <a ng-click="go(my.id)"><span class="fa fa-pencil-square-o"></span></a>

some useful information: Difference between double and single curly brace in angular JS?

Community
  • 1
  • 1
michael
  • 16,221
  • 7
  • 55
  • 60