HTML:
<li data-id="{{Name.first}}" ng-click="getNames('{{Name.first}}')">
脚本:
$scope.getNames = function(name) { // I am getting "{{Name.first}}" which I sent. I am not getting the template value $http({ method : "POST", url : "/some/url", params: { value: id }, headers: { 'Content-type': 'application/json' } }).then(function mySucces(response) { $scope.Results = response.data; }); }
请告诉我在调用方法时如何使用模板值?
{{}}从ng-click指令调用函数时,传递范围变量值而不插入值()。
{{}}
ng-click
<li data-id="{{Name.first}}" ng-click="getNames(Name.first)">