从AngularJS模板调用方法时如何处理引号?

时间:2014-06-23 12:44:40

标签: javascript angularjs

<tr ng-repeat="employee in Employees" class="gridRow" style="min-height:25px;">
  <td ng-click="showDeleteEmployeeDialog('{{employee.Id}}');"><img src="Images/delete.png" style="width:24px; height:24px; cursor:pointer;" /></td>

{{employee.Id}}最终会被评估为文字文本。 我希望它拨打showDeleteEmployeeDialog()并传递employeeId。 我该怎么做?

1 个答案:

答案 0 :(得分:0)

否认。我在这里找到了答案: AngularJS and HTML: Escaping quotes inside a variable for an onclick function

显然,引号和花括号应该省略。 纳克单击=&#34; showDeleteEmployeeDialog(employee.Id);&#34;