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?

1 Answer 1

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?

Sign up to request clarification or add additional context in comments.

1 Comment

perfect this worked ng-click="go('/edit/' + my.id)"

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.