在AngularJS中,我有一个链接,我需要从范围插入一个值,我试过这个:
$scope.go = function (path) {
$location.path(path);
};
<a ng-click="go('/edit/{{my.id}}')"><span class="fa fa-pencil-square-o"></span></a>
但这只是传入/edit/%7B%7Bmy.id%
这怎么可能在模板中?
答案 0 :(得分:2)
$scope.go = function (id) {
$location.path('/edit/'+id);
};
<a ng-click="go(my.id)"><span class="fa fa-pencil-square-o"></span></a>
一些有用的信息:Difference between double and single curly brace in angular JS?